Module: Reddit::JsonListing::InstanceMethods
- Defined in:
- lib/ruby_reddit_api/json_listing.rb
Instance Method Summary collapse
-
#parse(json) ⇒ true
Iterate over JSON and set instance variables that map to each JSON key.
Instance Method Details
#parse(json) ⇒ true
Iterate over JSON and set instance variables that map to each JSON key
40 41 42 43 44 45 |
# File 'lib/ruby_reddit_api/json_listing.rb', line 40 def parse(json) json.keys.each do |key| instance_variable_set("@#{key}", json[key]) end true end |