Class: Pacer::Orient::Property

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/pacer-orient/property.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(el_type, property) ⇒ Property

Returns a new instance of Property.



12
13
14
15
# File 'lib/pacer-orient/property.rb', line 12

def initialize(el_type, property)
  @el_type = el_type
  @property = property
end

Instance Attribute Details

#el_typeObject (readonly)

Returns the value of attribute el_type.



5
6
7
# File 'lib/pacer-orient/property.rb', line 5

def el_type
  @el_type
end

#propertyObject (readonly)

Returns the value of attribute property.



5
6
7
# File 'lib/pacer-orient/property.rb', line 5

def property
  @property
end

Instance Method Details

#create_index!(index_type = :not_unique) ⇒ Object



21
22
23
24
25
26
# File 'lib/pacer-orient/property.rb', line 21

def create_index!(index_type = :not_unique)
  unless indexed?
    property.createIndex graph.index_type(index_type)
  end
  self
end

#drop!Object



38
39
40
41
# File 'lib/pacer-orient/property.rb', line 38

def drop!
  el_type.drop_property! name
  nil
end

#drop_index!Object



28
29
30
31
# File 'lib/pacer-orient/property.rb', line 28

def drop_index!
  graph.drop_key_index name if indexed?
  self
end

#graphObject



17
18
19
# File 'lib/pacer-orient/property.rb', line 17

def graph
  el_type.graph
end

#index_typeObject



57
58
59
60
61
62
# File 'lib/pacer-orient/property.rb', line 57

def index_type
  if i = index
    t = Graph::ITYPE_REVERSE[i.getType]
    t[:type] if t
  end
end

#inspectObject



74
75
76
# File 'lib/pacer-orient/property.rb', line 74

def inspect
  "#<#{ el_type.type_name.capitalize }Property #{ el_type.name }.#{ property.name } (#{ type })>"
end

#range_index?Boolean

Returns:

  • (Boolean)


43
44
45
46
47
48
# File 'lib/pacer-orient/property.rb', line 43

def range_index?
  if i = index
    t = Graph::ITYPE_REVERSE[i.getType]
    t[:range] if t
  end
end

#set_type!(t) ⇒ Object



33
34
35
36
# File 'lib/pacer-orient/property.rb', line 33

def set_type!(t)
  # Not implemented as of 1.7.8
  fail Pacer::InternalError.new("Type migration is a planned Orient 2.x feature")
end

#unique_index?Boolean

Returns:

  • (Boolean)


50
51
52
53
54
55
# File 'lib/pacer-orient/property.rb', line 50

def unique_index?
  if i = index
    t = Graph::ITYPE_REVERSE[i.getType]
    t[:unique] if t
  end
end