Sha256: 4dc2150361978f4dfcf8d5226599a7af2aefc11e56a9412066a99777168a69d4

Contents?: true

Size: 515 Bytes

Versions: 3

Compression:

Stored size: 515 Bytes

Contents

module Punchfork
  
  # Wrapper for search results providing dot syntax
  class Search
    
    def initialize(*args)
      @hash = args[0]
      @attributes = {}
      
      @hash.each do |k, v|
        instance_variable_set("@#{k}", v)
        self.class.class_eval{attr_reader k}
        @attributes[k] = v
      end
      
      @recipes = @recipes.map{ |recipe_hash| recipe = Recipe.new(recipe_hash) }
    end
    
    attr_reader :attributes
    
    def [](key)
      @hash[key]
    end
    
  end
  
  
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
punchfork-0.0.7 lib/punchfork/search.rb
punchfork-0.0.6 lib/punchfork/search.rb
punchfork-0.0.5 lib/punchfork/search.rb