Class: OdataDuty::ComplexType
- Inherits:
-
Object
- Object
- OdataDuty::ComplexType
- Defined in:
- lib/odata_duty/complex_type.rb
Direct Known Subclasses
Defined Under Namespace
Classes: Metadata
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
-
#od_context ⇒ Object
readonly
Returns the value of attribute od_context.
Class Method Summary collapse
- .__metadata ⇒ Object
- .description(text = nil) ⇒ Object
- .properties ⇒ Object
- .property(name, *args, **kwargs) ⇒ Object
Instance Method Summary collapse
-
#initialize(object, context) ⇒ ComplexType
constructor
A new instance of ComplexType.
Constructor Details
#initialize(object, context) ⇒ ComplexType
Returns a new instance of ComplexType.
74 75 76 77 |
# File 'lib/odata_duty/complex_type.rb', line 74 def initialize(object, context) @object = object @od_context = context end |
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
71 72 73 |
# File 'lib/odata_duty/complex_type.rb', line 71 def object @object end |
#od_context ⇒ Object (readonly)
Returns the value of attribute od_context.
72 73 74 |
# File 'lib/odata_duty/complex_type.rb', line 72 def od_context @od_context end |
Class Method Details
.__metadata ⇒ Object
67 68 69 |
# File 'lib/odata_duty/complex_type.rb', line 67 def self. Metadata.new(self) end |
.description(text = nil) ⇒ Object
5 6 7 8 |
# File 'lib/odata_duty/complex_type.rb', line 5 def self.description(text = nil) @description = Property.resolve_description(.name, text) unless text.nil? @description end |
.properties ⇒ Object
10 11 12 |
# File 'lib/odata_duty/complex_type.rb', line 10 def self.properties @properties ||= [] end |
.property(name, *args, **kwargs) ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/odata_duty/complex_type.rb', line 14 def self.property(name, *args, **kwargs) if properties.any? { |p| p.name == name.to_sym } raise PropertyAlreadyDefinedError, "#{name} is already defined" end Property.new(name, *args, **kwargs).tap do |property| properties << property end end |