Sha256: 90e722817d314fbcf719ce3cd65681033efb68e89d2d778b26819eb83b842dcc

Contents?: true

Size: 470 Bytes

Versions: 3

Compression:

Stored size: 470 Bytes

Contents

module Leap
  module Subject
    def self.extended(base)
      base.instance_variable_set :@decisions, {}
    end
    attr_reader :decisions
    def decide(goal, options = {}, &blk)
      decisions[goal] = ::Leap::Decision.new goal, options
      Blockenspiel.invoke(blk, decisions[goal])
      define_method goal do |*considerations|
        self.class.decisions[goal].make send(self.class.decisions[goal].signature_method), *considerations
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
leap-0.2.4 lib/leap/subject.rb
leap-0.2.3 lib/leap/subject.rb
leap-0.2.2 lib/leap/subject.rb