Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
ruby_version: [2.6.9, 2.7.5, 3.0.3]
ruby_version: ["2.6", "2.7", "3.0", "3.1", "3.2"]
steps:
- uses: actions/checkout@v2
- name: Set up Ruby
Expand Down
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
require "bundler/gem_tasks"
require "rspec/core/rake_task"

RSpec::Core::RakeTask.new(:spec)
rspec = RSpec::Core::RakeTask.new(:spec)
rspec.ruby_opts = "-w"

task :default => :spec
8 changes: 6 additions & 2 deletions lib/active_operation/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class ActiveOperation::Base
include SmartProperties
include ActiveSupport::Callbacks

attr_accessor :output
attr_writer :output
attr_accessor :error

property :state, accepts: [:initialized, :halted, :succeeded, :failed], required: true, default: :initialized
Expand All @@ -19,6 +19,7 @@ class << self
def perform(*args)
new(*args).call
end
ruby2_keywords :perform if respond_to?(:ruby2_keywords, true)

def from_proc(execute)
Class.new(self) do
Expand Down Expand Up @@ -54,15 +55,18 @@ def from_proc(execute)
def call(*args)
perform(*args)
end
ruby2_keywords :call if respond_to?(:ruby2_keywords, true)

def inputs
[]
end

def to_proc
->(*args) {
proc = ->(*args) {
perform(*args)
}
proc.ruby2_keywords if proc.respond_to?(:ruby2_keywords)
proc
end

protected
Expand Down
2 changes: 1 addition & 1 deletion lib/active_operation/pipeline.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def new(context, *input)
result[key] = value.kind_of?(Proc) ? context.instance_exec(&value) : value
end

__getobj__.new *positional_args, attributes_from_input.merge(attributes_from_pipeline)
__getobj__.new(*positional_args, attributes_from_input.merge(attributes_from_pipeline))
end
end

Expand Down
2 changes: 1 addition & 1 deletion spec/active_operation/pipeline_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ def execute
pipeline = described_class.compose do
use -> { 2 }
use -> (number) { number * 2 }
use -> (number) { number -1 }
use -> (number) { number - 1 }
end

expect(pipeline).to succeed_to_perform.and_return(3)
Expand Down
4 changes: 4 additions & 0 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
if Warning.respond_to?(:[])
Warning[:deprecated] = true
end

require 'pry'
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'active_operation'