Method: Rubyvis::Scale::Ordinal#to_proc
- Defined in:
- lib/rubyvis/scale/ordinal.rb
#to_proc ⇒ Object
Return
lambda {|d| scale_object.scale(d)}
Useful as value on dynamic properties
scale=Rubyvis.ordinal("red","blue","green")
.fill_style(scale)
is the same as
.fill_style(lambda {|x| scale.scale(x)})
74 75 76 77 |
# File 'lib/rubyvis/scale/ordinal.rb', line 74 def to_proc that=self lambda {|*args| args[0] ? that.scale(args[0]) : nil } end |