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.
-
#foreign_key ⇒ Object
Returns the foreign_key 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.
30 31 32 |
# File 'lib/active_resource/reflection.rb', line 30 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
42 43 44 |
# File 'lib/active_resource/reflection.rb', line 42 def macro @macro end |
#name ⇒ Object (readonly)
Returns the name of the macro.
has_many :clients
returns :clients
37 38 39 |
# File 'lib/active_resource/reflection.rb', line 37 def name @name end |
#options ⇒ Object (readonly)
Returns the hash of options used for the macro.
has_many :clients
returns {}
47 48 49 |
# File 'lib/active_resource/reflection.rb', line 47 def @options end |
Instance Method Details
#class_name ⇒ Object
Returns the class name for the macro.
has_many :clients
returns 'Client'
59 60 61 |
# File 'lib/active_resource/reflection.rb', line 59 def class_name @class_name ||= derive_class_name end |
#foreign_key ⇒ Object
Returns the foreign_key for the macro.
64 65 66 |
# File 'lib/active_resource/reflection.rb', line 64 def foreign_key @foreign_key ||= derive_foreign_key end |
#klass ⇒ Object
Returns the class for the macro.
has_many :clients
returns the Client class
52 53 54 |
# File 'lib/active_resource/reflection.rb', line 52 def klass @klass ||= class_name.constantize end |