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



15
16
17
18
# File 'lib/store_schema/configuration.rb', line 15

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

Instance Attribute Details

#attributesHash (readonly)

Returns:

  • (Hash)


11
12
13
# File 'lib/store_schema/configuration.rb', line 11

def attributes
  @attributes
end

#columnSymbol (readonly)

Returns:

  • (Symbol)


7
8
9
# File 'lib/store_schema/configuration.rb', line 7

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



51
52
53
# File 'lib/store_schema/configuration.rb', line 51

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



44
45
46
# File 'lib/store_schema/configuration.rb', line 44

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



37
38
39
# File 'lib/store_schema/configuration.rb', line 37

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



30
31
32
# File 'lib/store_schema/configuration.rb', line 30

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



23
24
25
# File 'lib/store_schema/configuration.rb', line 23

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