Class: Proc
- Defined in:
- lib/rmtools/core/b.rb,
lib/rmtools/core/proc.rb,
lib/rmtools/dev/highlight.rb
Constant Summary collapse
- NULL =
lambda {|*x|}
- TRUE =
lambda {|*x| true}
- FALSE =
lambda {|*x| false}
- SELF =
lambda {|x| x}
Instance Attribute Summary collapse
-
#string ⇒ Object
Returns the value of attribute string.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#string ⇒ Object
Returns the value of attribute string.
7 8 9 |
# File 'lib/rmtools/core/proc.rb', line 7 def string @string end |
Class Method Details
.eval(string, binding = nil) ⇒ Object
18 19 20 21 |
# File 'lib/rmtools/core/proc.rb', line 18 def eval string, binding=nil (proc = (binding || Kernel).eval "lambda {#{string}}").string = string proc end |
.false ⇒ Object
26 |
# File 'lib/rmtools/core/proc.rb', line 26 def false; FALSE end |
.noop ⇒ Object
24 |
# File 'lib/rmtools/core/proc.rb', line 24 def noop; NULL end |
.self ⇒ Object
23 |
# File 'lib/rmtools/core/proc.rb', line 23 def self; SELF end |
.true ⇒ Object
25 |
# File 'lib/rmtools/core/proc.rb', line 25 def true; TRUE end |
Instance Method Details
#b ⇒ Object
20 |
# File 'lib/rmtools/core/b.rb', line 20 def b; (self != NULL) && self end |
#inspect ⇒ Object
28 29 30 |
# File 'lib/rmtools/dev/highlight.rb', line 28 def inspect "#{to_s}#{@string ? ': '+Painter.green(@string) : source_location && ": \n"+RMTools.highlighted_line(*source_location)}" end |
#source_location ⇒ Object
30 |
# File 'lib/rmtools/core/proc.rb', line 30 def source_location; to_s.match(/([^@]+):(\d+)>$/)[1..2] end |
#when ⇒ Object
9 10 11 12 13 14 |
# File 'lib/rmtools/core/proc.rb', line 9 def when Thread.new do sleep 0.001 until yield call end end |