class OData::AbstractSchema::End

Attributes

association[R]
entity_type[R]
options[RW]
return_type[R]

Public Class Methods

new(schema, association, entity_type, return_type, name, options = {}) click to toggle source
Calls superclass method
# File lib/o_data/abstract_schema/end.rb, line 17
def initialize(schema, association, entity_type, return_type, name, options = {})
  super(schema, name)
  
  @association = association
  @entity_type = entity_type
  @return_type = return_type
  
  unless @entity_type.nil?
    @return_type ||= @entity_type.qualified_name
  end

  @options = {}
  options.keys.select { |key| @@end_option_names.include?(key.to_s) }.each do |key|
    @options[key.to_sym] = options[key]
  end
end

Public Instance Methods

inspect() click to toggle source
# File lib/o_data/abstract_schema/end.rb, line 45
def inspect
  "#<< #{qualified_name.to_s}(return_type: #{@return_type.to_s}, to_multiplicity: #{to_multiplicity.to_s}) >>"
end
to_multiplicity() click to toggle source

def return_type

@options[:multiple] ? 'Collection(' + @return_type.to_s + ')' : @return_type.to_s

end

# File lib/o_data/abstract_schema/end.rb, line 38
def to_multiplicity
  m = (@options[:nullable] ? '0' : '1') + '..' + (@options[:multiple] ? '*' : '1')
  m = '1' if m == '1..1'
  m = '*' if m == '0..*'
  m
end