Class: StoreSchema::AccessorDefiner

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

Defined Under Namespace

Classes: InvalidValueType

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



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

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

Instance Attribute Details

#attributeSymbol (readonly)

Returns:

  • (Symbol)


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

def attribute
  @attribute
end

#columnSymbol (readonly)

Returns:

  • (Symbol)


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

def column
  @column
end

#klassClass (readonly)

Returns:

  • (Class)


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

def klass
  @klass
end

#typeSymbol (readonly)

Returns:

  • (Symbol)


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

def type
  @type
end

Instance Method Details

#defineObject

Defines all necessary accessors on #klass.



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

def define
  define_store_accessor
  define_getter
  define_setter
end