Class: OData::AbstractSchema::SchemaObject

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/o_data/abstract_schema/schema_object.rb

Direct Known Subclasses

Association, End, EntityType, NavigationProperty, Property

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Comparable

#compare, #sort

Constructor Details

#initialize(schema, name) ⇒ SchemaObject

Returns a new instance of SchemaObject.



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

def initialize(schema, name)
  @schema = schema
  @name = name
end

Instance Attribute Details

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/o_data/abstract_schema/schema_object.rb', line 5

def name
  @name
end

#schemaObject (readonly)

Returns the value of attribute schema.



4
5
6
# File 'lib/o_data/abstract_schema/schema_object.rb', line 4

def schema
  @schema
end

Instance Method Details

#<=>(other) ⇒ Object



18
19
20
21
22
# File 'lib/o_data/abstract_schema/schema_object.rb', line 18

def <=>(other)
  return qualified_name <=> other.qualified_name if other.is_a?(OData::SchemaObject)
  return -1 if other.blank?
  1
end

#inspectObject



32
33
34
# File 'lib/o_data/abstract_schema/schema_object.rb', line 32

def inspect
  "#<< #{@schema.namespace}(<< #{@name.inspect}: #{self.class.name.to_s} >>) >>"
end

#plural_nameObject



28
29
30
# File 'lib/o_data/abstract_schema/schema_object.rb', line 28

def plural_name
  name.to_s.pluralize
end

#qualified_nameObject



12
13
14
# File 'lib/o_data/abstract_schema/schema_object.rb', line 12

def qualified_name
  @schema.qualify(@name)
end

#singular_nameObject



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

def singular_name
  name.to_s.singularize
end