Class: Pacer::Orient::OrientType
- Inherits:
-
Object
- Object
- Pacer::Orient::OrientType
- Extended by:
- Forwardable
- Defined in:
- lib/pacer-orient/orient_type.rb
Instance Attribute Summary collapse
-
#element_type ⇒ Object
readonly
Returns the value of attribute element_type.
-
#graph ⇒ Object
readonly
Returns the value of attribute graph.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #drop_property!(name) ⇒ Object
- #indexed?(name) ⇒ Boolean
- #indexed_properties ⇒ Object
-
#initialize(graph, element_type, type) ⇒ OrientType
constructor
A new instance of OrientType.
- #inspect ⇒ Object
- #properties ⇒ Object
- #property(name) ⇒ Object
- #property!(name, otype) ⇒ Object
- #raw_property(name) ⇒ Object
- #set_super_class(sc) ⇒ Object
- #super_class ⇒ Object
Constructor Details
#initialize(graph, element_type, type) ⇒ OrientType
Returns a new instance of OrientType.
21 22 23 24 25 |
# File 'lib/pacer-orient/orient_type.rb', line 21 def initialize(graph, element_type, type) @graph = graph @element_type = type @type = type end |
Instance Attribute Details
#element_type ⇒ Object (readonly)
Returns the value of attribute element_type.
5 6 7 |
# File 'lib/pacer-orient/orient_type.rb', line 5 def element_type @element_type end |
#graph ⇒ Object (readonly)
Returns the value of attribute graph.
5 6 7 |
# File 'lib/pacer-orient/orient_type.rb', line 5 def graph @graph end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
5 6 7 |
# File 'lib/pacer-orient/orient_type.rb', line 5 def type @type end |
Instance Method Details
#drop_property!(name) ⇒ Object
64 65 66 |
# File 'lib/pacer-orient/orient_type.rb', line 64 def drop_property!(name) type.dropProperty name end |
#indexed?(name) ⇒ Boolean
35 36 37 38 |
# File 'lib/pacer-orient/orient_type.rb', line 35 def indexed?(name) p = property(name) p.indexed? if p end |
#indexed_properties ⇒ Object
72 73 74 |
# File 'lib/pacer-orient/orient_type.rb', line 72 def indexed_properties type.indexedProperties.map { |p| Property.new self, p } end |
#inspect ⇒ Object
76 77 78 79 80 |
# File 'lib/pacer-orient/orient_type.rb', line 76 def inspect abs = "Abstract" if abstract? strict = " (strict)" if strict_mode? "#<#{ abs }#{ type_name.capitalize }Type #{ name }#{ strict }>" end |
#properties ⇒ Object
68 69 70 |
# File 'lib/pacer-orient/orient_type.rb', line 68 def properties type.properties.map { |p| Property.new self, p } end |
#property(name) ⇒ Object
40 41 42 43 |
# File 'lib/pacer-orient/orient_type.rb', line 40 def property(name) p = raw_property(name) Property.new self, p if p end |
#property!(name, otype) ⇒ Object
45 46 47 48 49 50 51 |
# File 'lib/pacer-orient/orient_type.rb', line 45 def property!(name, otype) p = raw_property(name) unless p p = type.createProperty(name.to_s, graph.property_type(otype)) end Property.new self, p end |
#raw_property(name) ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/pacer-orient/orient_type.rb', line 27 def raw_property(name) if name.is_a? Symbol or name.is_a? String type.getProperty name.to_s else name end end |
#set_super_class(sc) ⇒ Object
59 60 61 62 |
# File 'lib/pacer-orient/orient_type.rb', line 59 def set_super_class(sc) type.setSuperClass graph.orient_type(element_type, sc) self end |
#super_class ⇒ Object
53 54 55 56 57 |
# File 'lib/pacer-orient/orient_type.rb', line 53 def super_class if base_classes.any? OrientType.new graph, type.getSuperClass end end |