Class: H8::ProcGate

Inherits:
Object show all
Defined in:
lib/h8/context.rb

Overview

The gate for Ruby’s callable to support javascript’s ‘apply’ functionality

Instance Method Summary collapse

Constructor Details

#initialize(callable) ⇒ ProcGate

Returns a new instance of ProcGate.



266
267
268
# File 'lib/h8/context.rb', line 266

def initialize callable
  @callable = callable
end

Instance Method Details

#apply(this, args) ⇒ Object



270
271
272
# File 'lib/h8/context.rb', line 270

def apply this, args
  @callable.call *args
end

#call(*args) ⇒ Object



274
275
276
# File 'lib/h8/context.rb', line 274

def call *args
  @callable.call *args
end