Class: FrOData::Properties::String
- Inherits:
-
FrOData::Property
- Object
- FrOData::Property
- FrOData::Properties::String
- Defined in:
- lib/frodata/properties/string.rb
Overview
Defines the String FrOData type.
Instance Attribute Summary
Attributes inherited from FrOData::Property
Instance Method Summary collapse
-
#default_value ⇒ Object
The default value for the property.
-
#has_default_value? ⇒ Boolean
Does the property have a default value.
-
#is_unicode? ⇒ Boolean
Is the property value Unicode encoded.
-
#type ⇒ Object
The FrOData type name.
-
#url_value ⇒ String
Value to be used in URLs.
-
#value ⇒ String?
Returns the property value, properly typecast.
-
#value=(new_value) ⇒ Object
Sets the property value.
Methods inherited from FrOData::Property
#==, #allows_nil?, #concurrency_mode, from_xml, #initialize, #json_value, #strict?, #to_xml, #xml_value
Constructor Details
This class inherits a constructor from FrOData::Property
Instance Method Details
#default_value ⇒ Object
The default value for the property
44 45 46 |
# File 'lib/frodata/properties/string.rb', line 44 def default_value [:default_value] end |
#has_default_value? ⇒ Boolean
Does the property have a default value
39 40 41 |
# File 'lib/frodata/properties/string.rb', line 39 def has_default_value? not([:default_value].nil?) end |
#is_unicode? ⇒ Boolean
Is the property value Unicode encoded
34 35 36 |
# File 'lib/frodata/properties/string.rb', line 34 def is_unicode? [:unicode] end |
#type ⇒ Object
The FrOData type name
29 30 31 |
# File 'lib/frodata/properties/string.rb', line 29 def type 'Edm.String' end |
#url_value ⇒ String
Value to be used in URLs.
24 25 26 |
# File 'lib/frodata/properties/string.rb', line 24 def url_value "'#{value}'" end |
#value ⇒ String?
Returns the property value, properly typecast
7 8 9 10 11 12 13 |
# File 'lib/frodata/properties/string.rb', line 7 def value if (@value.nil? || @value.empty?) && allows_nil? nil else encode_value(@value) end end |
#value=(new_value) ⇒ Object
Sets the property value
17 18 19 20 |
# File 'lib/frodata/properties/string.rb', line 17 def value=(new_value) validate(new_value) @value = new_value.nil? ? nil : encode_value(new_value.to_s) end |