Class: OData::AbstractSchema::Association

Inherits:
SchemaObject show all
Defined in:
lib/o_data/abstract_schema/association.rb

Direct Known Subclasses

OData::ActiveRecordSchema::Association

Constant Summary collapse

@@polymorphic_namespace_name =
'$polymorphic'

Instance Attribute Summary collapse

Attributes inherited from SchemaObject

#name, #schema

Instance Method Summary collapse

Methods inherited from SchemaObject

#<=>, #plural_name, #qualified_name, #singular_name

Methods included from Comparable

#compare, #sort

Constructor Details

#initialize(schema, name, from_end_options = {}, to_end_options = {}) ⇒ Association

Returns a new instance of Association.



9
10
11
12
13
14
# File 'lib/o_data/abstract_schema/association.rb', line 9

def initialize(schema, name, from_end_options = {}, to_end_options = {})
  super(schema, name)

  self.FromEnd(from_end_options.delete(:entity_type), from_end_options.delete(:return_type), from_end_options.delete(:name), from_end_options)
  self.ToEnd(to_end_options.delete(:entity_type), to_end_options.delete(:return_type), to_end_options.delete(:name), to_end_options)
end

Instance Attribute Details

#from_endObject

Returns the value of attribute from_end.



7
8
9
# File 'lib/o_data/abstract_schema/association.rb', line 7

def from_end
  @from_end
end

#to_endObject

Returns the value of attribute to_end.



7
8
9
# File 'lib/o_data/abstract_schema/association.rb', line 7

def to_end
  @to_end
end

Instance Method Details

#FromEnd(*args) ⇒ Object



16
17
18
# File 'lib/o_data/abstract_schema/association.rb', line 16

def FromEnd(*args)
  @from_end = End.new(self.schema, self, *args)
end

#inspectObject



24
25
26
# File 'lib/o_data/abstract_schema/association.rb', line 24

def inspect
  "#<< #{qualified_name.to_s}(#{[@from_end, @to_end].flatten.collect { |e| "#{e.name.to_s}: #{e.return_type.to_s}" }.join(", ")}) >>"
end

#ToEnd(*args) ⇒ Object



20
21
22
# File 'lib/o_data/abstract_schema/association.rb', line 20

def ToEnd(*args)
  @to_end = End.new(self.schema, self, *args)
end