Class: FrOData::Properties::String

Inherits:
FrOData::Property show all
Defined in:
lib/frodata/properties/string.rb

Overview

Defines the String FrOData type.

Instance Attribute Summary

Attributes inherited from FrOData::Property

#name, #options

Instance Method Summary collapse

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_valueObject

The default value for the property



44
45
46
# File 'lib/frodata/properties/string.rb', line 44

def default_value
  options[:default_value]
end

#has_default_value?Boolean

Does the property have a default value

Returns:



39
40
41
# File 'lib/frodata/properties/string.rb', line 39

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

#is_unicode?Boolean

Is the property value Unicode encoded

Returns:



34
35
36
# File 'lib/frodata/properties/string.rb', line 34

def is_unicode?
  options[:unicode]
end

#typeObject

The FrOData type name



29
30
31
# File 'lib/frodata/properties/string.rb', line 29

def type
  'Edm.String'
end

#url_valueString

Value to be used in URLs.

Returns:



24
25
26
# File 'lib/frodata/properties/string.rb', line 24

def url_value
  "'#{value}'"
end

#valueString?

Returns the property value, properly typecast

Returns:



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