Class: Waistband::Result
- Inherits:
-
Object
show all
- Defined in:
- lib/waistband/result.rb
Instance Method Summary
collapse
Constructor Details
#initialize(result_hash) ⇒ Result
4
5
6
|
# File 'lib/waistband/result.rb', line 4
def initialize(result_hash)
@result_hash = result_hash
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
8
9
10
11
12
|
# File 'lib/waistband/result.rb', line 8
def method_missing(method_name, *args, &block)
return @result_hash[method_name.to_s] if @result_hash.keys.include?(method_name.to_s)
return @result_hash['_source'][method_name.to_s] if @result_hash['_source'] && @result_hash['_source'].keys.include?(method_name.to_s)
nil
end
|
Instance Method Details
#respond_to_missing?(method_name, include_private = false) ⇒ Boolean
14
15
16
17
18
|
# File 'lib/waistband/result.rb', line 14
def respond_to_missing?(method_name, include_private = false)
return true if @result_hash.keys.include?(method_name.to_s)
return true if @result_hash['_source'] && @result_hash['_source'].keys.include?(method_name.to_s)
super
end
|