Class: Restfulie::Client::Mikyung::ThenCondition
- Inherits:
-
Object
- Object
- Restfulie::Client::Mikyung::ThenCondition
- Defined in:
- lib/restfulie/client/mikyung/then_condition.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
Instance Method Summary collapse
-
#execute(resource, goal, mikyung) ⇒ Object
finds the rule for this result and executes it.
-
#initialize(description) ⇒ ThenCondition
constructor
creates a new result, based on this description.
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
#description ⇒ Object (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 |