Class: Bhf::Mongoid::Document::Reflection
- Inherits:
-
Object
- Object
- Bhf::Mongoid::Document::Reflection
- Defined in:
- lib/bhf/mongoid/document.rb
Instance Attribute Summary collapse
-
#klass ⇒ Object
readonly
Returns the value of attribute klass.
-
#macro ⇒ Object
readonly
Returns the value of attribute macro.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#primary_key_name ⇒ Object
readonly
Returns the value of attribute primary_key_name.
Instance Method Summary collapse
-
#initialize(mongoid_field) ⇒ Reflection
constructor
A new instance of Reflection.
Constructor Details
#initialize(mongoid_field) ⇒ Reflection
Returns a new instance of Reflection.
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bhf/mongoid/document.rb', line 20 def initialize(mongoid_field) @name = mongoid_field.name @klass = mongoid_field.class_name.constantize @primary_key_name = mongoid_field.key @macro = case mongoid_field.macro when :references_and_referenced_in_many :has_and_belongs_to_many when :references_many :has_many when :references_one :has_one when :referenced_in :belongs_to else mongoid_field.macro end end |
Instance Attribute Details
#klass ⇒ Object (readonly)
Returns the value of attribute klass.
18 19 20 |
# File 'lib/bhf/mongoid/document.rb', line 18 def klass @klass end |
#macro ⇒ Object (readonly)
Returns the value of attribute macro.
18 19 20 |
# File 'lib/bhf/mongoid/document.rb', line 18 def macro @macro end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/bhf/mongoid/document.rb', line 18 def name @name end |
#primary_key_name ⇒ Object (readonly)
Returns the value of attribute primary_key_name.
18 19 20 |
# File 'lib/bhf/mongoid/document.rb', line 18 def primary_key_name @primary_key_name end |