Class: Csvbuilder::AttributeBase
- Inherits:
-
Object
- Object
- Csvbuilder::AttributeBase
- Includes:
- ColumnShared
- Defined in:
- lib/csvbuilder/core/internal/attribute_base.rb
Instance Attribute Summary collapse
-
#column_name ⇒ Object
readonly
Returns the value of attribute column_name.
-
#row_model ⇒ Object
readonly
Returns the value of attribute row_model.
Instance Method Summary collapse
-
#formatted_value ⇒ Object
The value with formatting applied.
-
#initialize(column_name, row_model) ⇒ AttributeBase
constructor
A new instance of AttributeBase.
-
#source_value ⇒ Object
The unchanged value from the source.
-
#value ⇒ Object
The value.
Methods included from ColumnShared
Constructor Details
#initialize(column_name, row_model) ⇒ AttributeBase
Returns a new instance of AttributeBase.
11 12 13 14 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 11 def initialize(column_name, row_model) @column_name = column_name @row_model = row_model end |
Instance Attribute Details
#column_name ⇒ Object (readonly)
Returns the value of attribute column_name.
9 10 11 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 9 def column_name @column_name end |
#row_model ⇒ Object (readonly)
Returns the value of attribute row_model.
9 10 11 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 9 def row_model @row_model end |
Instance Method Details
#formatted_value ⇒ Object
Returns the value with formatting applied.
17 18 19 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 17 def formatted_value @formatted_value ||= row_model_class.format_cell(source_value, column_name, row_model.context) end |
#source_value ⇒ Object
Returns the unchanged value from the source.
27 28 29 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 27 def source_value raise NotImplementedError end |
#value ⇒ Object
Returns the value.
22 23 24 |
# File 'lib/csvbuilder/core/internal/attribute_base.rb', line 22 def value raise NotImplementedError end |