Class: Yelp::Record

Inherits:
Object
  • Object
show all
Defined in:
lib/yelpster/record.rb

Overview

General-purpose record that allows passing a hash with parameters to populate object attributes defined via methods like attr_reader or attr_accessor.

Direct Known Subclasses

ResponseFormat, V1::Request, V2::Request

Instance Method Summary (collapse)

Constructor Details

- (Record) initialize(params)

Returns a new instance of Record



7
8
9
10
11
12
13
14
# File 'lib/yelpster/record.rb', line 7

def initialize (params)
  if !params.nil?
    params.each do |key, value| 
      name = key.to_s
      instance_variable_set("@#{name}", value) if respond_to?(name)
    end
  end
end