Class: FalseClass

Inherits:
Object
  • Object
show all
Defined in:
lib/therefore/false_class_patch.rb

Instance Method Summary collapse

Instance Method Details

#otherwise(*args, &block) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/therefore/false_class_patch.rb', line 12

def otherwise *args, &block
  if args.empty?
    if block_given?
      yield self
    else
      Enumerator.new do |yielder|
        yielder << self
      end
    end
  else
    args.first.therefore(&block)
  end
end

#thereforeObject



2
3
4
5
6
7
8
9
10
# File 'lib/therefore/false_class_patch.rb', line 2

def therefore
  if block_given?
    self
  else
    Enumerator.new do
      # Empty enumerator
    end
  end
end