Class: RelationDrivenObjective

Inherits:
Object
  • Object
show all
Defined in:
lib/mikyung.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.executes(what, options = {}) ⇒ Object



13
14
15
# File 'lib/mikyung.rb', line 13

def self.executes(what, options = {})
  internals << [options[:when], what]
end

.has_relation?(rel) ⇒ Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/mikyung.rb', line 17

def self.has_relation?(rel)
  HasRelation.new(rel)
end

Instance Method Details

#internalsObject



21
22
23
# File 'lib/mikyung.rb', line 21

def internals
  self.class.internals
end

#next_step(resource) ⇒ Object



25
26
27
28
29
30
# File 'lib/mikyung.rb', line 25

def next_step(resource)
  step = internals.find do |k|
    k.first.matches?(resource)
  end
  step ? step.last : nil    
end