Class: NaranyaEcm::Search::Hit
- Inherits:
-
Object
- Object
- NaranyaEcm::Search::Hit
- Defined in:
- lib/naranya_ecm/search/hit.rb
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#order ⇒ Object
readonly
Returns the value of attribute order.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#updated_at ⇒ Object
readonly
Returns the value of attribute updated_at.
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Hit
constructor
A new instance of Hit.
- #klass ⇒ Object
Constructor Details
#initialize(attributes = {}) ⇒ Hit
Returns a new instance of Hit.
4 5 6 7 8 9 10 11 12 |
# File 'lib/naranya_ecm/search/hit.rb', line 4 def initialize(attributes={}) @id = attributes.delete :_id @type = attributes.delete :_type @score = attributes.delete :_score source = attributes.delete :_source @updated_at = source.has_key?(:updated_at) ? source.delete(:updated_at).to_datetime : nil @order = attributes.delete :order end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'lib/naranya_ecm/search/hit.rb', line 3 def id @id end |
#order ⇒ Object (readonly)
Returns the value of attribute order.
3 4 5 |
# File 'lib/naranya_ecm/search/hit.rb', line 3 def order @order end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
3 4 5 |
# File 'lib/naranya_ecm/search/hit.rb', line 3 def score @score end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
3 4 5 |
# File 'lib/naranya_ecm/search/hit.rb', line 3 def type @type end |
#updated_at ⇒ Object (readonly)
Returns the value of attribute updated_at.
3 4 5 |
# File 'lib/naranya_ecm/search/hit.rb', line 3 def updated_at @updated_at end |
Instance Method Details
#klass ⇒ Object
14 15 16 |
# File 'lib/naranya_ecm/search/hit.rb', line 14 def klass @klass ||= "NaranyaEcm::#{type.classify}".constantize end |