Class: RCharts::GraphHelper::Graph::Axis::Caster
- Inherits:
-
Object
- Object
- RCharts::GraphHelper::Graph::Axis::Caster
- Defined in:
- app/helpers/rcharts/graph_helper/graph/axis/caster.rb
Overview
:nodoc:
Instance Method Summary collapse
- #casting ⇒ Object
- #downcast ⇒ Object
-
#initialize(value) ⇒ Caster
constructor
A new instance of Caster.
Constructor Details
#initialize(value) ⇒ Caster
Returns a new instance of Caster.
8 9 10 |
# File 'app/helpers/rcharts/graph_helper/graph/axis/caster.rb', line 8 def initialize(value) @value = value end |
Instance Method Details
#casting ⇒ Object
12 13 14 |
# File 'app/helpers/rcharts/graph_helper/graph/axis/caster.rb', line 12 def casting upcast(yield downcast) end |
#downcast ⇒ Object
16 17 18 19 20 21 22 |
# File 'app/helpers/rcharts/graph_helper/graph/axis/caster.rb', line 16 def downcast case value when Time then value.to_i when Date then value.jd + value.day_fraction else value end end |