Sha256: 0c6c9ea678b1d977671f3837773dc58c1957d10e615b6b5f2f6bbb18c6a7ebd6

Contents?: true

Size: 1.04 KB

Versions: 26

Compression:

Stored size: 1.04 KB

Contents

module Foobara
  module Value
    class Processor
      class Runner
        class << self
          def runner_methods(*method_names)
            method_names.each do |method_name|
              instance_variable = :"@#{method_name}"

              define_method method_name do
                if instance_variables.include?(instance_variable)
                  instance_variable_get(instance_variable)
                else
                  instance_variable_set(instance_variable, processor.send(method_name, value))
                end
              end
            end
          end
        end

        attr_accessor :value, :processor

        def initialize(processor, value)
          self.processor = processor
          self.value = value
        end

        runner_methods :error_message,
                       :error_context,
                       :process_value,
                       :process_value!,
                       :process_outcome,
                       :process_outcome!,
                       :applicable?
      end
    end
  end
end

Version data entries

26 entries across 26 versions & 1 rubygems

Version Path
foobara-0.0.26 projects/value/src/processor/runner.rb
foobara-0.0.25 projects/value/src/processor/runner.rb
foobara-0.0.24 projects/value/src/processor/runner.rb
foobara-0.0.23 projects/value/src/processor/runner.rb
foobara-0.0.22 projects/value/src/processor/runner.rb
foobara-0.0.21 projects/value/src/processor/runner.rb
foobara-0.0.20 projects/value/src/processor/runner.rb
foobara-0.0.19 projects/value/src/processor/runner.rb
foobara-0.0.18 projects/value/src/processor/runner.rb
foobara-0.0.17 projects/value/src/processor/runner.rb
foobara-0.0.16 projects/value/src/processor/runner.rb
foobara-0.0.15 projects/value/src/processor/runner.rb
foobara-0.0.14 projects/value/src/processor/runner.rb
foobara-0.0.13 projects/value/src/processor/runner.rb
foobara-0.0.12 projects/value/src/processor/runner.rb
foobara-0.0.11 projects/value/src/processor/runner.rb
foobara-0.0.10 projects/value/src/processor/runner.rb
foobara-0.0.9 projects/value/src/processor/runner.rb
foobara-0.0.8 projects/value/src/processor/runner.rb
foobara-0.0.7 projects/value/src/processor/runner.rb