Sha256: 05f4b2395460fcd277f5e22ad4df45af0b23151f67517a84e3a94058aea9e524

Contents?: true

Size: 690 Bytes

Versions: 3

Compression:

Stored size: 690 Bytes

Contents

# frozen_string_literal: true

module Fluxo
  class Operation
    module Constructor
      def self.included(klass)
        klass.extend(ClassMethods)
      end

      module ClassMethods
        def inherited(subclass)
          subclass.instance_variable_set(:@attribute_names, @attribute_names.dup)
        end

        def def_Operation(op_module)
          tap do |klass|
            op_module.define_singleton_method(:Operation) do |*attrs|
              klass.Operation(*attrs)
            end
          end
        end

        def Operation(*attrs)
          Class.new(self).tap do |klass|
            klass.attributes(*attrs)
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fluxo-0.2.1 lib/fluxo/operation/constructor.rb
fluxo-0.2.0 lib/fluxo/operation/constructor.rb
fluxo-0.1.0 lib/fluxo/operation/constructor.rb