Sha256: a92a6bb4a849bfc54cfb02f0af570a9a296082c693a4bfbd9204e36a12f7d4bd

Contents?: true

Size: 677 Bytes

Versions: 14

Compression:

Stored size: 677 Bytes

Contents

module Waistband
  class Result

    def initialize(result_hash)
      @result_hash = result_hash
    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

    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

  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
waistband-0.11.2 lib/waistband/result.rb
waistband-0.11.1 lib/waistband/result.rb
waistband-0.11.0 lib/waistband/result.rb
waistband-0.10.0 lib/waistband/result.rb
waistband-0.9.9 lib/waistband/result.rb
waistband-0.9.8 lib/waistband/result.rb
waistband-0.9.7 lib/waistband/result.rb
waistband-0.9.6 lib/waistband/result.rb
waistband-0.9.5 lib/waistband/result.rb
waistband-0.9.4 lib/waistband/result.rb
waistband-0.9.3 lib/waistband/result.rb
waistband-0.9.2 lib/waistband/result.rb
waistband-0.9.1 lib/waistband/result.rb
waistband-0.9.0 lib/waistband/result.rb