class StoreSchema::Configuration
Attributes
attributes[R]
@return [Hash]
column[R]
@return [Symbol]
Public Class Methods
new(column)
click to toggle source
@param column [Symbol] the table column to generate the accessors for
# File lib/store_schema/configuration.rb, line 15 def initialize(column) @column = column @attributes = {} end
Public Instance Methods
boolean(attribute)
click to toggle source
@param attribute [Symbol] the name of the attribute on {#column}
for which to generate a Boolean-type accessor
# File lib/store_schema/configuration.rb, line 51 def boolean(attribute) attributes[attribute] = :boolean end
datetime(attribute)
click to toggle source
@param attribute [Symbol] the name of the attribute on {#column}
for which to generate a DateTime-type accessor
# File lib/store_schema/configuration.rb, line 44 def datetime(attribute) attributes[attribute] = :datetime end
float(attribute)
click to toggle source
@param attribute [Symbol] the name of the attribute on {#column}
for which to generate a Float-type accessor
# File lib/store_schema/configuration.rb, line 37 def float(attribute) attributes[attribute] = :float end
integer(attribute)
click to toggle source
@param attribute [Symbol] the name of the attribute on {#column}
for which to generate an Integer-type accessor
# File lib/store_schema/configuration.rb, line 30 def integer(attribute) attributes[attribute] = :integer end
string(attribute)
click to toggle source
@param attribute [Symbol] the name of the attribute on {#column}
for which to generate a String-type accessor
# File lib/store_schema/configuration.rb, line 23 def string(attribute) attributes[attribute] = :string end
Private Instance Methods
configure(klass)
click to toggle source
Iterates over all defined {#attributes} and defines the necessary accessors for them.
@param klass [Class] the class to define the accessors on
# File lib/store_schema/configuration.rb, line 62 def configure(klass) attributes.each do |attribute, type| StoreSchema::AccessorDefiner .new(klass, column, type, attribute).define end end