Class: OData::AbstractSchema::Property

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

Direct Known Subclasses

OData::ActiveRecordSchema::Property

Constant Summary collapse

@@edm_null =
'Edm.Null'.freeze

Instance Attribute Summary collapse

Attributes inherited from SchemaObject

#name, #schema

Instance Method Summary collapse

Methods inherited from SchemaObject

#<=>, #plural_name, #singular_name

Methods included from Comparable

#compare, #sort

Constructor Details

#initialize(schema, entity_type, name, return_type = @@edm_null, nullable = true) ⇒ Property

Returns a new instance of Property.



10
11
12
13
14
15
16
# File 'lib/o_data/abstract_schema/property.rb', line 10

def initialize(schema, entity_type, name, return_type = @@edm_null, nullable = true)
  super(schema, name)

  @entity_type = entity_type
  @return_type = return_type
  @nullable = nullable
end

Instance Attribute Details

#entity_typeObject (readonly)

Returns the value of attribute entity_type.



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

def entity_type
  @entity_type
end

#nullableObject

Returns the value of attribute nullable.



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

def nullable
  @nullable
end

#return_typeObject

Returns the value of attribute return_type.



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

def return_type
  @return_type
end

Instance Method Details

#inspectObject



30
31
32
# File 'lib/o_data/abstract_schema/property.rb', line 30

def inspect
  "#<< {qualified_name.to_s}(return_type: #{@return_type.to_s}, nullable: #{nullable?}) >>"
end

#nullable?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/o_data/abstract_schema/property.rb', line 18

def nullable?
  !!@nullable
end

#qualified_nameObject



26
27
28
# File 'lib/o_data/abstract_schema/property.rb', line 26

def qualified_name
  @entity_type.qualified_name.to_s + '#' + self.name
end

#value_for(one) ⇒ Object



22
23
24
# File 'lib/o_data/abstract_schema/property.rb', line 22

def value_for(one)
  nil
end