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
27
28
# File 'lib/pacer-orient/property.rb', line 21

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

#drop!Object



40
41
42
43
# File 'lib/pacer-orient/property.rb', line 40

def drop!
  el_type.drop_property! name
  nil
end

#drop_index!Object



30
31
32
33
# File 'lib/pacer-orient/property.rb', line 30

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

#inspectObject



55
56
57
# File 'lib/pacer-orient/property.rb', line 55

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

#set_type!(t) ⇒ Object



35
36
37
38
# File 'lib/pacer-orient/property.rb', line 35

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