Class: ActiveResource::Reflection::AssociationReflection
- Inherits:
-
Object
- Object
- ActiveResource::Reflection::AssociationReflection
- Defined in:
- lib/active_resource/reflection.rb
Instance Attribute Summary collapse
-
#macro ⇒ Object
readonly
Returns the macro type.
-
#name ⇒ Object
readonly
Returns the name of the macro.
-
#options ⇒ Object
readonly
Returns the hash of options used for the macro.
Instance Method Summary collapse
-
#class_name ⇒ Object
Returns the class name for the macro.
-
#initialize(macro, name, options) ⇒ AssociationReflection
constructor
A new instance of AssociationReflection.
-
#klass ⇒ Object
Returns the class for the macro.
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, ) @macro, @name, @options = macro, name, end |
Instance Attribute Details
#macro ⇒ Object (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 |
#name ⇒ Object (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 |
#options ⇒ Object (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 end |
Instance Method Details
#class_name ⇒ Object
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 |
#klass ⇒ Object
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 |