Class: OData::Properties::String

Inherits:
OData::Property show all
Defined in:
lib/odata/properties/string.rb

Overview

Defines the String OData type.

Instance Attribute Summary

Attributes inherited from OData::Property

#name

Instance Method Summary collapse

Methods inherited from OData::Property

#==, #allows_nil?, #concurrency_mode, #initialize, #to_xml, #url_value, #xml_value

Constructor Details

This class inherits a constructor from OData::Property

Instance Method Details

#default_valueObject

The default value for the property



38
39
40
# File 'lib/odata/properties/string.rb', line 38

def default_value
  options[:default_value]
end

#has_default_value?Boolean

Does the property have a default value

Returns:



33
34
35
# File 'lib/odata/properties/string.rb', line 33

def has_default_value?
  not(options[:default_value].nil?)
end

#is_unicode?Boolean

Is the property value Unicode encoded

Returns:



28
29
30
# File 'lib/odata/properties/string.rb', line 28

def is_unicode?
  options[:unicode]
end

#typeObject

The OData type name



23
24
25
# File 'lib/odata/properties/string.rb', line 23

def type
  'Edm.String'
end

#valueString?

Returns the property value, properly typecast

Returns:



7
8
9
10
11
12
13
# File 'lib/odata/properties/string.rb', line 7

def value
  if @value.nil? && allows_nil?
    nil
  else
    encode_value(@value)
  end
end

#value=(new_value) ⇒ Object

Sets the property value



17
18
19
20
# File 'lib/odata/properties/string.rb', line 17

def value=(new_value)
  validate(new_value)
  @value = new_value.nil? ? nil : encode_value(new_value.to_s)
end