Class: DataDisplay::Actions::Display

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::NumberHelper, ActionView::Helpers::TextHelper, ActiveSupport::Inflector
Defined in:
lib/data_display/actions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw_value, format) ⇒ Display

Returns a new instance of Display.



10
11
12
13
# File 'lib/data_display/actions.rb', line 10

def initialize(raw_value, format)
  @raw_value = raw_value
  @format = format && format.to_sym
end

Instance Attribute Details

#formatObject (readonly)

Returns the value of attribute format.



8
9
10
# File 'lib/data_display/actions.rb', line 8

def format
  @format
end

#raw_valueObject (readonly)

Returns the value of attribute raw_value.



8
9
10
# File 'lib/data_display/actions.rb', line 8

def raw_value
  @raw_value
end

Instance Method Details

#valueObject



15
16
17
# File 'lib/data_display/actions.rb', line 15

def value
  respond_to?(method_name, true) ? send(method_name) : raw_value
end