Class: Needish::User
- Inherits:
-
Object
- Object
- Needish::User
- Includes:
- EasyClassMaker
- Defined in:
- lib/needish/user.rb
Class Method Summary collapse
-
.new_from_xml(xml) ⇒ Object
Creates a new user from a piece of xml.
Methods included from EasyClassMaker
Class Method Details
.new_from_xml(xml) ⇒ Object
Creates a new user from a piece of xml
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/needish/user.rb', line 11 def new_from_xml(xml) User.new do |u| u.id = xml.search("user").first[:id] u.name = xml.search("user").first[:name] u.lastname = xml.search("user").first[:lastname] u.nickname = xml.search("user").first[:nickname] u.pictureurl = xml.search("user").first[:pictureurl] u.displayname = xml.search("user").first[:displayname] u.biography = xml.search('biobraphy').inner_html.gsub!(/\<\!\[CDATA\[(.*)\]\]\>/m, '\1') end end |