Class: OData::Property

Inherits:
Object
  • Object
show all
Defined in:
lib/odata/property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value, options = {}) ⇒ Property

Default intialization for a property with a name, value and options.

Parameters:

  • name (to_s)
  • value (to_s, nil)
  • options (Hash) (defaults to: {})


10
11
12
13
14
# File 'lib/odata/property.rb', line 10

def initialize(name, value, options = {})
  @name = name.to_s
  @value = value.nil? ? nil : value.to_s
  @options = default_options.merge(options)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/odata/property.rb', line 3

def name
  @name
end

#valueObject

Returns the value of attribute value.



4
5
6
# File 'lib/odata/property.rb', line 4

def value
  @value
end

Instance Method Details

#==(other) ⇒ Boolean

Provides for value-based equality checking.

Parameters:

  • other (value)

    object for comparison

Returns:

  • (Boolean)


26
27
28
# File 'lib/odata/property.rb', line 26

def ==(other)
  self.value == other.value
end

#allows_nil?Boolean

Whether the property permits a nil value.

Returns:

  • (Boolean)


32
33
34
# File 'lib/odata/property.rb', line 32

def allows_nil?
  @allows_nil ||= options[:allows_nil]
end

#concurrency_modeString

The configured concurrency mode for the property.

Returns:

  • (String)


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

def concurrency_mode
  @concurrecy_mode ||= options[:concurrency_mode]
end

#typeObject

Abstract implementation, should return property type, based on OData::Service metadata in proper implementation.

Raises:

  • NotImplementedError



19
20
21
# File 'lib/odata/property.rb', line 19

def type
  raise NotImplementedError
end

#xml_valueString

Value to be used in XML.

Returns:

  • (String)


44
45
46
# File 'lib/odata/property.rb', line 44

def xml_value
  @value
end