Class: Restfulie::Client::Mikyung::ThenCondition

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description) ⇒ ThenCondition

creates a new result, based on this description



11
12
13
# File 'lib/restfulie/client/mikyung/then_condition.rb', line 11

def initialize(description)
  @description = description
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/restfulie/client/mikyung/then_condition.rb', line 8

def description
  @description
end

Instance Method Details

#execute(resource, goal, mikyung) ⇒ Object

finds the rule for this result and executes it



16
17
18
19
20
21
22
23
# File 'lib/restfulie/client/mikyung/then_condition.rb', line 16

def execute(resource, goal, mikyung)
  goal.then_rules.each do |rule|
    if (matches = Regexp.new(rule[0]).match(@description))
      return invoke_rule(rule[1], resource, matches, mikyung)
    end
  end
  nil
end