Module: Wordpress::ContentItem::ClassMethods
- Defined in:
- lib/content_item.rb
Instance Method Summary collapse
Instance Method Details
#from_struct(api, struct) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/content_item.rb', line 4 def from_struct(api, struct) content_item = self.new self::ATTRIBUTE_MATCHES[api].each do |struct_attribute, item_attribute| value = struct[struct_attribute.to_s] value = value.to_date if value.kind_of?XMLRPC::DateTime content_item.send("#{item_attribute}=", value) unless value.nil? end content_item end |