class Opera::MobileStore::DeviceModel
Attributes
code[RW]
All attributes are Read-Only…
id[RW]
All attributes are Read-Only…
name[RW]
All attributes are Read-Only…
Public Class Methods
build_from_nokogiri_node(node)
click to toggle source
# File lib/opera/mobile_store/device_model.rb, line 28 def self.build_from_nokogiri_node(node) data = { id: node.xpath("number(@id)").to_i, code: node.xpath("string(@code)").strip, name: node.text.strip }.select { |key, val| val.present? } self.new data end
Public Instance Methods
attributes()
click to toggle source
# File lib/opera/mobile_store/device_model.rb, line 18 def attributes [:id, :code, :name].inject({}) do |hash, field_name| field_value = self.public_send field_name hash[field_name.to_s] = field_value unless field_value.nil? hash end end