Class: TMDBParty::Person
- Inherits:
-
Object
- Object
- TMDBParty::Person
- Includes:
- Attributes
- Defined in:
- lib/tmdb_party/person.rb
Instance Attribute Summary collapse
-
#tmdb ⇒ Object
readonly
Returns the value of attribute tmdb.
Instance Method Summary collapse
- #biography ⇒ Object
- #get_info! ⇒ Object
-
#initialize(values, tmdb) ⇒ Person
constructor
A new instance of Person.
Methods included from Attributes
Constructor Details
#initialize(values, tmdb) ⇒ Person
Returns a new instance of Person.
11 12 13 14 |
# File 'lib/tmdb_party/person.rb', line 11 def initialize(values, tmdb) @tmdb = tmdb self.attributes = values end |
Instance Attribute Details
#tmdb ⇒ Object (readonly)
Returns the value of attribute tmdb.
4 5 6 |
# File 'lib/tmdb_party/person.rb', line 4 def tmdb @tmdb end |
Instance Method Details
#biography ⇒ Object
16 17 18 19 20 |
# File 'lib/tmdb_party/person.rb', line 16 def biography # HTTParty does not parse the encoded hexadecimal properly. It does not consider 000F to be a hex, but 000f is # A bug has been submitted about this read_attribute('biography').gsub("\\n", "\n").gsub(/\\u([0-9A-F]{4})/) { [$1.hex].pack("U") } end |
#get_info! ⇒ Object
23 24 25 26 27 |
# File 'lib/tmdb_party/person.rb', line 23 def get_info! person = tmdb.get_person(self.id) @attributes.merge!(person.attributes) if person @loaded = true end |