lib/waistband/result.rb in waistband-0.11.2 vs lib/waistband/result.rb in waistband-0.11.3

- old
+ new

@@ -3,9 +3,17 @@ def initialize(result_hash) @result_hash = result_hash end + def to_hash + @result_hash['_source'] + end + + def [](key) + @result_hash['_source'][key.to_s] + end + 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