Class: OdataDuty::ComplexType

Inherits:
Object
  • Object
show all
Defined in:
lib/odata_duty/complex_type.rb

Direct Known Subclasses

EntityType, SchemaBuilder::EntityType

Defined Under Namespace

Classes: Metadata

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(object, context) ⇒ ComplexType

Returns a new instance of ComplexType.



65
66
67
68
# File 'lib/odata_duty/complex_type.rb', line 65

def initialize(object, context)
  @object = object
  @od_context = context
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



62
63
64
# File 'lib/odata_duty/complex_type.rb', line 62

def object
  @object
end

#od_contextObject (readonly)

Returns the value of attribute od_context.



63
64
65
# File 'lib/odata_duty/complex_type.rb', line 63

def od_context
  @od_context
end

Class Method Details

.__metadataObject



58
59
60
# File 'lib/odata_duty/complex_type.rb', line 58

def self.
  Metadata.new(self)
end

.propertiesObject



5
6
7
# File 'lib/odata_duty/complex_type.rb', line 5

def self.properties
  @properties ||= []
end

.property(name, *args, **kwargs) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/odata_duty/complex_type.rb', line 9

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