Module: IfElse::TrueIfBehavior

Included in:
Object
Defined in:
lib/ifelse.rb

Instance Method Summary collapse

Instance Method Details

#if {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



5
6
7
8
# File 'lib/ifelse.rb', line 5

def if
  raise "Syntax Error: if without block" unless block_given?
  yield self
end

#unlessObject



10
11
12
13
# File 'lib/ifelse.rb', line 10

def unless
  raise "Syntax Error: unless without block" unless block_given?
  false
end