Class: StoreSchema::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/store_schema/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column) ⇒ Configuration

Returns a new instance of Configuration.

Parameters:

  • column (Symbol)

    the table column to generate the accessors for


13
14
15
16
# File 'lib/store_schema/configuration.rb', line 13

def initialize(column)
  @column = column
  @attributes = {}
end

Instance Attribute Details

#attributesHash (readonly)

Returns:

  • (Hash)

9
10
11
# File 'lib/store_schema/configuration.rb', line 9

def attributes
  @attributes
end

#columnSymbol (readonly)

Returns:

  • (Symbol)

5
6
7
# File 'lib/store_schema/configuration.rb', line 5

def column
  @column
end

Instance Method Details

#boolean(attribute) ⇒ Object

Parameters:

  • attribute (Symbol)

    the name of the attribute on #column for which to generate a Boolean-type accessor


49
50
51
# File 'lib/store_schema/configuration.rb', line 49

def boolean(attribute)
  attributes[attribute] = :boolean
end

#datetime(attribute) ⇒ Object

Parameters:

  • attribute (Symbol)

    the name of the attribute on #column for which to generate a DateTime-type accessor


42
43
44
# File 'lib/store_schema/configuration.rb', line 42

def datetime(attribute)
  attributes[attribute] = :datetime
end

#float(attribute) ⇒ Object

Parameters:

  • attribute (Symbol)

    the name of the attribute on #column for which to generate a Float-type accessor


35
36
37
# File 'lib/store_schema/configuration.rb', line 35

def float(attribute)
  attributes[attribute] = :float
end

#integer(attribute) ⇒ Object

Parameters:

  • attribute (Symbol)

    the name of the attribute on #column for which to generate an Integer-type accessor


28
29
30
# File 'lib/store_schema/configuration.rb', line 28

def integer(attribute)
  attributes[attribute] = :integer
end

#string(attribute) ⇒ Object

Parameters:

  • attribute (Symbol)

    the name of the attribute on #column for which to generate a String-type accessor


21
22
23
# File 'lib/store_schema/configuration.rb', line 21

def string(attribute)
  attributes[attribute] = :string
end