Class: Eg::ColumnIndex::Column
- Inherits:
-
Object
- Object
- Eg::ColumnIndex::Column
- Defined in:
- lib/eg/column_index.rb
Overview
Helper class
Constant Summary collapse
- @@metadata =
{ 'column_name' => String, 'column_type' => Class, 'column' => Object, 'class_name' => Class }
Instance Attribute Summary collapse
-
#class_name ⇒ Object
Returns the value of attribute class_name.
-
#column ⇒ Object
Returns the value of attribute column.
-
#column_name ⇒ Object
Returns the value of attribute column_name.
-
#column_type ⇒ Object
Returns the value of attribute column_type.
Class Method Summary collapse
Instance Attribute Details
#class_name ⇒ Object
Returns the value of attribute class_name.
68 69 70 |
# File 'lib/eg/column_index.rb', line 68 def class_name @class_name end |
#column ⇒ Object
Returns the value of attribute column.
68 69 70 |
# File 'lib/eg/column_index.rb', line 68 def column @column end |
#column_name ⇒ Object
Returns the value of attribute column_name.
68 69 70 |
# File 'lib/eg/column_index.rb', line 68 def column_name @column_name end |
#column_type ⇒ Object
Returns the value of attribute column_type.
68 69 70 |
# File 'lib/eg/column_index.rb', line 68 def column_type @column_type end |
Class Method Details
.create(obj, attribute) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/eg/column_index.rb', line 71 def Column.create obj, attribute c = new c.column = attribute c.class_name = obj.class column_name = attribute.to_s column_name_parts = column_name.split(/_/) c.column_name = column_name_parts.shift column_name_parts.each {|name| c.column_name += name.capitalize} c.column_type = obj.class.[column_name] c end |
.metadata ⇒ Object
70 |
# File 'lib/eg/column_index.rb', line 70 def Column.; @@metadata; end |