Class: Elastictastic::Association Private
- Inherits:
-
Object
- Object
- Elastictastic::Association
- Defined in:
- lib/elastictastic/association.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Container for information about generic Elastictastic associations – this might be an embed association or a parent/child association.
Instance Attribute Summary collapse
- #name ⇒ Object readonly private
- #options ⇒ Object readonly private
Instance Method Summary collapse
- #class_name ⇒ Object private
- #clazz ⇒ Object private
- #extract(instance) ⇒ Object private
-
#initialize(name, options = {}) ⇒ Association
constructor
private
A new instance of Association.
Constructor Details
#initialize(name, options = {}) ⇒ Association
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Association.
11 12 13 |
# File 'lib/elastictastic/association.rb', line 11 def initialize(name, = {}) @name, @options = name.to_s, .symbolize_keys end |
Instance Attribute Details
#name ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/elastictastic/association.rb', line 9 def name @name end |
#options ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
9 10 11 |
# File 'lib/elastictastic/association.rb', line 9 def @options end |
Instance Method Details
#class_name ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
15 16 17 |
# File 'lib/elastictastic/association.rb', line 15 def class_name @options[:class_name] || @name.to_s.classify end |
#clazz ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
19 20 21 |
# File 'lib/elastictastic/association.rb', line 19 def clazz @clazz ||= class_name.constantize end |
#extract(instance) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
23 24 25 |
# File 'lib/elastictastic/association.rb', line 23 def extract(instance) instance.__send__(name) end |