Class: Waistband::QueryResult
- Inherits:
-
Object
- Object
- Waistband::QueryResult
- Defined in:
- lib/waistband/query_result.rb
Instance Attribute Summary collapse
-
#_id ⇒ Object
readonly
Returns the value of attribute _id.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Instance Method Summary collapse
-
#initialize(row) ⇒ QueryResult
constructor
A new instance of QueryResult.
- #method_missing(method_name, *args, &block) ⇒ Object
- #respond_to_missing?(method_name, include_private = false) ⇒ Boolean
Constructor Details
#initialize(row) ⇒ QueryResult
Returns a new instance of QueryResult.
8 9 10 11 12 |
# File 'lib/waistband/query_result.rb', line 8 def initialize(row) @source = row['_source'].stringify_keys @_id = row['_id'] @score = row['_score'] end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
14 15 16 |
# File 'lib/waistband/query_result.rb', line 14 def method_missing(method_name, *args, &block) @source[method_name.to_s] end |
Instance Attribute Details
#_id ⇒ Object (readonly)
Returns the value of attribute _id.
6 7 8 |
# File 'lib/waistband/query_result.rb', line 6 def _id @_id end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
6 7 8 |
# File 'lib/waistband/query_result.rb', line 6 def score @score end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/waistband/query_result.rb', line 6 def source @source end |
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
18 19 20 21 |
# File 'lib/waistband/query_result.rb', line 18 def respond_to_missing?(method_name, include_private = false) return true if @source.has_key?(method_name.to_s) super end |