Method: BOAST::If#initialize
- Defined in:
- lib/BOAST/Language/If.rb
#initialize(condition, &block) ⇒ If #initialize(conditions, &block) ⇒ If
Creates a new instance of the If construct
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/BOAST/Language/If.rb', line 17 def initialize(conditions, &block) super() @conditions = [] @blocks = [] if conditions.is_a?(Hash) then else_block = conditions.delete(:else) else_block = block unless else_block or not block conditions.each { |key, value| @conditions.push key @blocks.push value } @blocks.push else_block if else_block else @conditions.push conditions @blocks.push block if block end end |