Class: Iolite::Statement::If
Instance Method Summary collapse
- #[](*then_) ⇒ Object
-
#initialize(cond) ⇒ If
constructor
A new instance of If.
Constructor Details
#initialize(cond) ⇒ If
Returns a new instance of If.
24 25 26 |
# File 'lib/iolite/statement/if.rb', line 24 def initialize cond @cond = cond end |
Instance Method Details
#[](*then_) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/iolite/statement/if.rb', line 28 def [](*then_) if_then = Iolite::Lazy.new { |*args| if Iolite::Functinal.invoke(@cond, *args) Iolite::Functinal.invoke_a(then_, *args).last end } cond = @cond (class << if_then; self; end).class_eval { define_method(:else_) { IfThenElse.new cond, then_ } } if_then end |