Class: Elastictastic::Association
- Inherits:
-
Object
- Object
- Elastictastic::Association
- Defined in:
- lib/elastictastic/association.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #class_name ⇒ Object
- #clazz ⇒ Object
- #extract(instance) ⇒ Object
-
#initialize(name, options = {}) ⇒ Association
constructor
A new instance of Association.
Constructor Details
#initialize(name, options = {}) ⇒ Association
Returns a new instance of Association.
5 6 7 |
# File 'lib/elastictastic/association.rb', line 5 def initialize(name, = {}) @name, = name.to_s, .symbolize_keys end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/elastictastic/association.rb', line 3 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/elastictastic/association.rb', line 3 def end |
Instance Method Details
#class_name ⇒ Object
9 10 11 |
# File 'lib/elastictastic/association.rb', line 9 def class_name [:class_name] || @name.to_s.classify end |
#clazz ⇒ Object
13 14 15 |
# File 'lib/elastictastic/association.rb', line 13 def clazz @clazz ||= class_name.constantize end |
#extract(instance) ⇒ Object
17 18 19 |
# File 'lib/elastictastic/association.rb', line 17 def extract(instance) instance.__send__(name) end |