Class: FrOData::Properties::Enum

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

Overview

Abstract base class for FrOData EnumTypes

See Also:

  • [FrOData[FrOData::Schema[FrOData::Schema::EnumType]

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, #type, #xml_value

Constructor Details

This class inherits a constructor from FrOData::Property

Instance Method Details

#url_valueString

Value to be used in URLs.

Returns:



25
26
27
# File 'lib/frodata/properties/enum.rb', line 25

def url_value
  "#{type}'#{@value}'"
end

#valueString?

Returns the property value, properly typecast

Returns:



8
9
10
11
12
13
14
# File 'lib/frodata/properties/enum.rb', line 8

def value
  if @value.nil? && allows_nil?
    nil
  else
    @value
  end
end

#value=(new_value) ⇒ Object

Sets the property value



18
19
20
21
# File 'lib/frodata/properties/enum.rb', line 18

def value=(new_value)
  parsed_value = validate(new_value)
  @value = is_flags? ? parsed_value : parsed_value.first
end