Method: Rubyvis::Scale::Quantitative#to_proc

Defined in:
lib/rubyvis/scale/quantitative.rb

#to_procObject

Return

lambda {|d| scale_object.scale(d)}

Useful as value on dynamic properties

scale=Rubyvis.linear(0,1000)
bar.width(scale)

is the same as

bar.width(lambda {|x| scale.scale(x)})


89
90
91
92
# File 'lib/rubyvis/scale/quantitative.rb', line 89

def to_proc
  that=self
  lambda {|*args|  args[0] ? that.scale(args[0]) : nil }
end