Class: Proc
- Defined in:
- lib/source/ruby.rb,
lib/source/redshift/code_events.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#==(other) ⇒ Object
call-seq: prc == other => true or false.
-
#[] ⇒ Object
call-seq: prc.call(params, …) -> obj prc[params, …] -> obj.
-
#arity ⇒ Object
FIX: Incomplete.
-
#call ⇒ Object
call-seq: prc.call(params, …) -> obj prc[params, …] -> obj.
-
#initialize(func) ⇒ Proc
constructor
call-seq: Proc.new {|…| block } -> proc.
-
#process_event(context, delay, args_array) ⇒ Object
:nodoc:.
-
#to_proc ⇒ Object
call-seq: proc.to_proc -> proc.
Constructor Details
#initialize(func) ⇒ Proc
call-seq:
Proc.new {|...| block } -> proc
Creates a new Proc
object, bound to the current context.
4728 4729 4730 4731 4732 |
# File 'lib/source/ruby.rb', line 4728 def initialize(func) `this.__block__=func` `this.__block__.__id__=func.__id__||Red.id++` `this.__id__=this.__block__.__id__` end |
Instance Method Details
#==(other) ⇒ Object
call-seq:
prc == other => true or false
Returns true
if prc and other are the same object, false
otherwise.
4740 4741 4742 |
# File 'lib/source/ruby.rb', line 4740 def ==(other) `this.__id__==other.__id__` end |
#[] ⇒ Object
4757 4758 4759 |
# File 'lib/source/ruby.rb', line 4757 def []() `this.__block__.apply(this,arguments)` end |
#call ⇒ Object
call-seq:
prc.call(params, ...) -> obj
prc[params, ...] -> obj
Invokes the block, setting the block’s parameters to the values in params using something close to method calling semantics.
Returns the value of the last expression evaluated in the block. See also Proc#yield
.
proc = Proc.new {|x| x * 100 }
proc.call(4) #=> 400
4779 4780 4781 |
# File 'lib/source/ruby.rb', line 4779 def call `this.__block__.apply(this,arguments)` end |
#process_event(context, delay, args_array) ⇒ Object
:nodoc:
198 199 200 201 202 |
# File 'lib/source/redshift/code_events.rb', line 198 def process_event(context, delay, args_array) # :nodoc: `var f=this.__block__.__unbound__,event_function=function(){return f.apply(context,args_array);}` `if(delay){return setTimeout(event_function,delay);}` `event_function()` end |
#to_proc ⇒ Object
call-seq:
proc.to_proc -> proc
Part of the protocol for converting objects to Proc
objects. Instances of class Proc
simply return themselves.
4789 4790 4791 |
# File 'lib/source/ruby.rb', line 4789 def to_proc return self end |