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


24
25
26
27
28
29
# File 'lib/store_schema/accessor_definer.rb', line 24

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

Instance Attribute Details

#attributeSymbol (readonly)

Returns:

  • (Symbol)

17
18
19
# File 'lib/store_schema/accessor_definer.rb', line 17

def attribute
  @attribute
end

#columnSymbol (readonly)

Returns:

  • (Symbol)

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

def column
  @column
end

#klassClass (readonly)

Returns:

  • (Class)

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

def klass
  @klass
end

#typeSymbol (readonly)

Returns:

  • (Symbol)

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

def type
  @type
end

Instance Method Details

#defineObject

Defines all necessary accessors on #klass.


33
34
35
36
37
38
# File 'lib/store_schema/accessor_definer.rb', line 33

def define
  define_store_accessor
  define_attribute
  define_getter
  define_setter
end