Copyright © 2014 by mTLD Top Level Domain Limited. All rights reserved.
Portions copyright © 2008 by Argo Interactive Limited.
Portions copyright © 2008 by Nokia Inc.
Portions copyright © 2008 by Telecom Italia Mobile S.p.A.
Portions copyright © 2008 by Volantis Systems Limited.
Portions copyright © 2002-2008 by Andreas Staeding.
Portions copyright © 2008 by Zandan.
dotMobi
Contains a hash of names to Property objects. An instance of this class is returned by DeviceApi.properties.
Overload of [](key) to consider property names as strings or symbols.
property_name
String or Symbol with the property_name.
return
Property value or nil if the property does not exist.
# File ../../device_api/trunk/ruby/src/lib/properties.rb, line 48 def [](property_name) if property_name.nil? return nil end return super(property_name) || super(property_name.to_sym) end
Checks whether the properties set has the given pair of property and value.
property_name
String or Symbol with the property name.
value_to_check
Value to check.
return
Boolean value.
# File ../../device_api/trunk/ruby/src/lib/properties.rb, line 25 def contains?(property_name, value_to_check = nil) if property_name.nil? return end if self.has_key?(property_name) && !value_to_check.nil? property = self[property_name] if property.data_type_id == DataType::BOOLEAN case value_to_check when 0,"0",false value_to_check = false when 1,"1",true value_to_check = true end return property.to_b == value_to_check end return property.to_s == value_to_check.to_s end return false end
Overload delete() to allow property names as symbols.
property_name
String or Symbol with the property_name.
return
Property object or nil if the property does not exist.
# File ../../device_api/trunk/ruby/src/lib/properties.rb, line 72 def delete(property_name) super(property_name) || super(property_name.to_sym) end
Gets the value of the given property identified by its name.
property_name
String or Symbol with the property_name.
return
Property value or nil if the property does not exist.
# File ../../device_api/trunk/ruby/src/lib/properties.rb, line 58 def get property_name return self[property_name] end
Overload has_key? to allow property names as symbols.
property_name
String or Symbol with the property_name.
return
Whether the property name exists in they key set.
# File ../../device_api/trunk/ruby/src/lib/properties.rb, line 65 def has_key?(property_name) return super(property_name) || super(property_name.to_sym) end