Class: Freenom::Expecting::ExpectingContext
- Inherits:
-
Object
- Object
- Freenom::Expecting::ExpectingContext
- Defined in:
- lib/freenom/dns/others/expecting.rb
Instance Attribute Summary collapse
-
#eithers ⇒ Object
Returns the value of attribute eithers.
Instance Method Summary collapse
- #either(name, &block) ⇒ Object
- #execute(context) ⇒ Object
-
#initialize ⇒ ExpectingContext
constructor
A new instance of ExpectingContext.
Constructor Details
#initialize ⇒ ExpectingContext
Returns a new instance of ExpectingContext.
8 9 10 |
# File 'lib/freenom/dns/others/expecting.rb', line 8 def initialize @eithers = [] end |
Instance Attribute Details
#eithers ⇒ Object
Returns the value of attribute eithers.
6 7 8 |
# File 'lib/freenom/dns/others/expecting.rb', line 6 def eithers @eithers end |
Instance Method Details
#either(name, &block) ⇒ Object
12 13 14 |
# File 'lib/freenom/dns/others/expecting.rb', line 12 def either(name, &block) @eithers << [name, block] end |
#execute(context) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/freenom/dns/others/expecting.rb', line 16 def execute(context) @eithers.each do |either| name = either[0] block = either[1] return name if context.instance_eval(&block) end nil end |