Module: Kernel

Defined in:
lib/hark/core_ext.rb

Instance Method Summary collapse

Instance Method Details

#hark(*args, &block) ⇒ Object



2
3
4
# File 'lib/hark/core_ext.rb', line 2

def hark *args, &block
  Hark.from *args, &block
end

#hearken(method, *args, &block) ⇒ Object



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

def hearken method, *args, &block
  listener = (block.arity == 1) ? hark(&block) : block.call
  send method, *args + [listener]
end

#to_hark(*args, &block) ⇒ Object



6
7
8
# File 'lib/hark/core_ext.rb', line 6

def to_hark *args, &block
  hark self, *args, &block
end