Class: RailsDataExplorer::Utils::ValueFormatter
- Inherits:
-
Object
- Object
- RailsDataExplorer::Utils::ValueFormatter
- Defined in:
- lib/rails_data_explorer/utils/value_formatter.rb
Overview
Responsibilities:
* Format values in data series and individual data
Good resource on significant figures:
Instance Attribute Summary collapse
-
#d3_format ⇒ Object
Returns the value of attribute d3_format.
-
#ruby_formatter ⇒ Object
Returns the value of attribute ruby_formatter.
-
#significant_figures ⇒ Object
Returns the value of attribute significant_figures.
Instance Method Summary collapse
-
#initialize(context) ⇒ ValueFormatter
constructor
@param context.
Constructor Details
#initialize(context) ⇒ ValueFormatter
@param context
17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/rails_data_explorer/utils/value_formatter.rb', line 17 def initialize(context) case context when DataSeries initialize_from_data_series(context) when Hash (context) when Numeric initialize_from_single_value(context) else raise "Handle this context: #{ context.inspect }" end end |
Instance Attribute Details
#d3_format ⇒ Object
Returns the value of attribute d3_format.
14 15 16 |
# File 'lib/rails_data_explorer/utils/value_formatter.rb', line 14 def d3_format @d3_format end |
#ruby_formatter ⇒ Object
Returns the value of attribute ruby_formatter.
14 15 16 |
# File 'lib/rails_data_explorer/utils/value_formatter.rb', line 14 def ruby_formatter @ruby_formatter end |
#significant_figures ⇒ Object
Returns the value of attribute significant_figures.
14 15 16 |
# File 'lib/rails_data_explorer/utils/value_formatter.rb', line 14 def significant_figures @significant_figures end |