Class: Humble::Column

Inherits:
Object
  • Object
show all
Defined in:
lib/humble/column.rb

Direct Known Subclasses

PrimaryKeyColumn

Instance Method Summary collapse

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

Returns:

  • (Boolean)


12
13
14
# File 'lib/humble/column.rb', line 12

def primary_key?
  false
end