Class: ActiveResource::Reflection::AssociationReflection

Inherits:
Object
  • Object
show all
Defined in:
lib/active_resource/reflection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(macro, name, options) ⇒ AssociationReflection

Returns a new instance of AssociationReflection.



39
40
41
# File 'lib/active_resource/reflection.rb', line 39

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

Instance Attribute Details

#macroObject (readonly)

Returns the macro type.

has_many :clients returns :has_many



51
52
53
# File 'lib/active_resource/reflection.rb', line 51

def macro
  @macro
end

#nameObject (readonly)

Returns the name of the macro.

has_many :clients returns :clients



46
47
48
# File 'lib/active_resource/reflection.rb', line 46

def name
  @name
end

#optionsObject (readonly)

Returns the hash of options used for the macro.

has_many :clients returns {}



56
57
58
# File 'lib/active_resource/reflection.rb', line 56

def options
  @options
end

Instance Method Details

#class_nameObject

Returns the class name for the macro.

has_many :clients returns 'Client'



68
69
70
# File 'lib/active_resource/reflection.rb', line 68

def class_name
  @class_name ||= derive_class_name
end

#klassObject

Returns the class for the macro.

has_many :clients returns the Client class



61
62
63
# File 'lib/active_resource/reflection.rb', line 61

def klass
  @klass ||= class_name.constantize
end