Class: AssociationReflection

Inherits:
Object
  • Object
show all
Defined in:
lib/spira/association_reflection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(macro, name, options = {}) ⇒ AssociationReflection

Returns a new instance of AssociationReflection



6
7
8
9
10
# File 'lib/spira/association_reflection.rb', line 6

def initialize(macro, name, options = {})
  @macro = macro
  @name = name
  @options = options
end

Instance Attribute Details

#macroObject (readonly)

Returns the value of attribute macro



2
3
4
# File 'lib/spira/association_reflection.rb', line 2

def macro
  @macro
end

#nameObject (readonly)

Returns the value of attribute name



3
4
5
# File 'lib/spira/association_reflection.rb', line 3

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options



4
5
6
# File 'lib/spira/association_reflection.rb', line 4

def options
  @options
end

Instance Method Details

#class_nameObject



12
13
14
# File 'lib/spira/association_reflection.rb', line 12

def class_name
  @class_name ||= (options[:type] || derive_class_name).to_s
end

#klassObject



16
17
18
# File 'lib/spira/association_reflection.rb', line 16

def klass
  @klass ||= class_name.constantize
end