Class: V

Inherits:
ActiveOrient::Model show all
Defined in:
lib/model/vertex.rb

Constant Summary

Constants included from OrientDB

OrientDB::DocumentDatabase, OrientDB::DocumentDatabasePool, OrientDB::DocumentDatabasePooled, OrientDB::GraphDatabase, OrientDB::IndexType, OrientDB::OClassImpl, OrientDB::OTraverse, OrientDB::PropertyImpl, OrientDB::RemoteStorage, OrientDB::SQLCommand, OrientDB::SQLSynchQuery, OrientDB::Schema, OrientDB::SchemaProxy, OrientDB::SchemaType, OrientDB::ServerAdmin, OrientDB::User, OrientDB::UsingJava

Instance Attribute Summary

Attributes inherited from ActiveOrient::Model

#metadata

Attributes inherited from ActiveOrient::Base

#metadata

Instance Method Summary collapse

Methods inherited from ActiveOrient::Model

autoload_object, delete_class, #document, #to_ary

Methods included from ModelClass

#add_edge_link, #all, #alter_property, #classname, #count, #create, #create_index, #create_properties, #create_property, #custom_where, #delete_property, #delete_record, #delete_records, #first, #get, #get_model_class, #get_properties, #get_records, #last, #match, #naming_convention, #orientdb_class, #print_class_properties, #query_database, #require_model_file, #superClass, #update_or_create_records, #update_records, #upsert, #where

Methods included from ModelRecord

#add_item_to_property, classname, #find, #from_orient, #increment_version, #is_edge?, #method_missing, #query, #reload!, #remove_item_from_property, #rid, #rrid, #save, #set_item_to_property, #to_or, #update, #update_item_property, #version, #version=

Methods included from ActiveOrient::BaseProperties

#==, #content_attributes, #default_attributes, #set_attribute_defaults, #to_human, #update_missing

Methods inherited from ActiveOrient::Base

#[], #[]=, attr_accessible, attr_protected, #attributes, #attributes=, display_rid, #document, get_rid, #initialize, remove_rid, serialize, store_rid, #to_model, #update_attribute

Constructor Details

This class inherits a constructor from ActiveOrient::Base

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ModelRecord

Instance Method Details

#edges(kind = :all) ⇒ Object

def delete delete an edge (as class method) and def remove delete an edge (as instance method)



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/model/vertex.rb', line 15

def edges kind=:all  # :all, :in, :out 
  expression = case kind
 when :all
   /^in|^out/ 
 when :in
   /^in/ 
 when :out
   /^out/ 
  end
  edges = attributes.keys.find_all{ |x| x =~  expression }
  edges.map{|x| attributes[x]}.flatten
end

#removeObject



28
29
30
# File 'lib/model/vertex.rb', line 28

def remove
  db.delete_vertex self
end