Class: RailsDataExplorer::Utils::ValueFormatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rails-data-explorer/utils/value_formatter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context) ⇒ ValueFormatter

@param context



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/rails-data-explorer/utils/value_formatter.rb', line 12

def initialize(context)
  case context
  when DataSeries
    initialize_from_data_series(context)
  when Hash
    initialize_from_options(context)
  when Numeric
    initialize_from_single_value(context)
  else
    raise "Handle this context: #{ context.inspect }"
  end
end

Instance Attribute Details

#d3_formatObject

Returns the value of attribute d3_format.



9
10
11
# File 'lib/rails-data-explorer/utils/value_formatter.rb', line 9

def d3_format
  @d3_format
end

#ruby_formatterObject

Returns the value of attribute ruby_formatter.



9
10
11
# File 'lib/rails-data-explorer/utils/value_formatter.rb', line 9

def ruby_formatter
  @ruby_formatter
end

#significant_figuresObject

Returns the value of attribute significant_figures.



9
10
11
# File 'lib/rails-data-explorer/utils/value_formatter.rb', line 9

def significant_figures
  @significant_figures
end