Class: Rotten::Entity

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/rotten/entity.rb

Direct Known Subclasses

Actor, Movie, Review

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_json(json) ⇒ Object



5
6
7
8
9
# File 'lib/rotten/entity.rb', line 5

def from_json(json)
  e = new
  e.attributes = json
  e
end

Instance Method Details

#attributes=(hash = {}) ⇒ Object



12
13
14
15
16
# File 'lib/rotten/entity.rb', line 12

def attributes= hash={}
  hash.each_pair do |k,v|
    instance_variable_get("@table")[k.to_sym] = v
  end
end