Sha256: 89636c4e1e280f6a3a281e0e2b3452ad39fb1211ef14653ae48d4756ba866e32
Contents?: true
Size: 668 Bytes
Versions: 2
Compression:
Stored size: 668 Bytes
Contents
module Leap module Subject def self.extended(base) base.instance_variable_set :@decisions, {} base.send :attr_reader, :deliberations 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| options = considerations.extract_options! @deliberations ||= {} @deliberations[goal] = self.class.decisions[goal].make(send(self.class.decisions[goal].signature_method), *considerations.push(options)) @deliberations[goal][goal] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
leap-0.4.1 | lib/leap/subject.rb |
leap-0.4.0 | lib/leap/subject.rb |