Class: CSVModel::Column
- Inherits:
-
Object
- Object
- CSVModel::Column
- Includes:
- Utilities::Options
- Defined in:
- lib/csv_model/column.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Attributes included from Utilities::Options
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ Column
constructor
A new instance of Column.
- #is_primary_key? ⇒ Boolean
- #key ⇒ Object
- #model_attribute ⇒ Object
Methods included from Utilities::Options
Constructor Details
#initialize(name, options = {}) ⇒ Column
Returns a new instance of Column.
9 10 11 12 |
# File 'lib/csv_model/column.rb', line 9 def initialize(name, = {}) @name = name @options = end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/csv_model/column.rb', line 7 def name @name end |
Instance Method Details
#is_primary_key? ⇒ Boolean
14 15 16 |
# File 'lib/csv_model/column.rb', line 14 def is_primary_key? option(:primary_key, false) end |
#key ⇒ Object
18 19 20 |
# File 'lib/csv_model/column.rb', line 18 def key name.to_column_key end |
#model_attribute ⇒ Object
22 23 24 |
# File 'lib/csv_model/column.rb', line 22 def model_attribute key.underscore.to_sym end |