Class: Humble::Column
- Inherits:
-
Object
- Object
- Humble::Column
- Defined in:
- lib/humble/column.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(name) ⇒ Column
constructor
A new instance of Column.
- #prepare(item) ⇒ Object
- #primary_key? ⇒ Boolean
Constructor Details
#initialize(name) ⇒ Column
Returns a new instance of Column.
3 4 5 |
# File 'lib/humble/column.rb', line 3 def initialize(name) @column_name = name end |
Instance Method Details
#prepare(item) ⇒ Object
7 8 9 10 |
# File 'lib/humble/column.rb', line 7 def prepare(item) return {} if primary_key? && has_default_value? { column_name.to_sym => item.instance_variable_get("@#{column_name}") } end |
#primary_key? ⇒ Boolean
12 13 14 |
# File 'lib/humble/column.rb', line 12 def primary_key? false end |