Sha256: b4810300fc792222311b482226bf85dc2a21b65ade0642cf62607187cd1217a9

Contents?: true

Size: 736 Bytes

Versions: 33

Compression:

Stored size: 736 Bytes

Contents

module Trailblazer::Operation::Module
  def self.included(base)
    base.extend ClassMethods
    base.extend Included
  end

  module Included # TODO: use representable's inheritance mechanism.
    def included(base)
      super
      instructions.each { |cfg|
        method  = cfg[0]
        args    = cfg[1].dup
        block   = cfg[2]
        # options = args.extract_options!.dup # we need to duplicate options has as AM::Validations messes it up later.

        base.send(method, *args, &block) } # property :name, {} do .. end
    end
  end

  module ClassMethods
    def method_missing(method, *args, &block)
      instructions << [method, args, block]
    end

    def instructions
      @instructions ||= []
    end
  end
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
trailblazer-2.1.0.rc1 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta7 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta6 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta5 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta4 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta3 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta2 lib/trailblazer/operation/module.rb
trailblazer-2.1.0.beta1 lib/trailblazer/operation/module.rb
trailblazer-2.0.7 lib/trailblazer/operation/module.rb
trailblazer-2.0.6 lib/trailblazer/operation/module.rb
trailblazer-2.0.5 lib/trailblazer/operation/module.rb
trailblazer-2.0.4 lib/trailblazer/operation/module.rb
trailblazer-2.0.3 lib/trailblazer/operation/module.rb
trailblazer-2.0.2 lib/trailblazer/operation/module.rb
trailblazer-2.0.1 lib/trailblazer/operation/module.rb
trailblazer-2.0.0 lib/trailblazer/operation/module.rb
trailblazer-2.0.0.rc1 lib/trailblazer/operation/module.rb
trailblazer-2.0.0.beta3 lib/trailblazer/operation/module.rb
trailblazer-2.0.0.beta2 lib/trailblazer/operation/module.rb
trailblazer-2.0.0.beta1 lib/trailblazer/operation/module.rb