Class: StoreSchema::AccessorDefiner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass, column, type, attribute) ⇒ AccessorDefiner

Returns a new instance of AccessorDefiner.

Parameters:

  • klass (Class)

    the class to define the accessor on

  • column (Symbol)

    the name of the column to define the accessor on

  • type (Symbol)

    the data type of the #attribute

  • attribute (Symbol)

    the name of the #column‘s attribute



26
27
28
29
30
31
# File 'lib/store_schema/accessor_definer.rb', line 26

def initialize(klass, column, type, attribute)
  @klass     = klass
  @column    = column
  @type      = type
  @attribute = attribute
end

Instance Attribute Details

#attributeSymbol (readonly)

Returns:

  • (Symbol)


19
20
21
# File 'lib/store_schema/accessor_definer.rb', line 19

def attribute
  @attribute
end

#columnSymbol (readonly)

Returns:

  • (Symbol)


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

def column
  @column
end

#klassClass (readonly)

Returns:

  • (Class)


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

def klass
  @klass
end

#typeSymbol (readonly)

Returns:

  • (Symbol)


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

def type
  @type
end

Instance Method Details

#defineObject

Defines all necessary accessors on #klass.



35
36
37
38
39
40
# File 'lib/store_schema/accessor_definer.rb', line 35

def define
  define_store_accessor
  define_attribute
  define_getter
  define_setter
end