Module: ArangoDb::Properties::ClassMethods
- Defined in:
- lib/arangodb-odm.rb
Instance Method Summary collapse
-
#after_create(value) ⇒ Object
Callback that is being invoked after a document is first created.
-
#after_destroy(value) ⇒ Object
Callback that is being invoked after a document was destroyed.
-
#after_save(value) ⇒ Object
Callback that is being invoked after a document was updated.
-
#before_create(value) ⇒ Object
Callback that is being invoked before a document is first created.
-
#before_destroy(value) ⇒ Object
Callback that is being invoked before a document is destroyed.
-
#before_save(value) ⇒ Object
Callback that is being invoked before a document is updated.
-
#collection(value) ⇒ Object
The collection to use for this document.
- #db_attrs(*attrs) ⇒ Object
- #skiplist(*fields) ⇒ Object
-
#target(value) ⇒ Object
Sets the document value proxy to use.
-
#transport(value) ⇒ Object
Sets the transport class to use.
Instance Method Details
#after_create(value) ⇒ Object
Callback that is being invoked after a document is first created.
84 85 86 87 88 |
# File 'lib/arangodb-odm.rb', line 84 def after_create(value) self.send(:define_method, 'after_create') do value end end |
#after_destroy(value) ⇒ Object
Callback that is being invoked after a document was destroyed.
112 113 114 115 116 |
# File 'lib/arangodb-odm.rb', line 112 def after_destroy(value) self.send(:define_method, 'after_destroy') do value end end |
#after_save(value) ⇒ Object
Callback that is being invoked after a document was updated.
98 99 100 101 102 |
# File 'lib/arangodb-odm.rb', line 98 def after_save(value) self.send(:define_method, 'after_save') do value end end |
#before_create(value) ⇒ Object
Callback that is being invoked before a document is first created.
77 78 79 80 81 |
# File 'lib/arangodb-odm.rb', line 77 def before_create(value) self.send(:define_method, 'before_create') do value end end |
#before_destroy(value) ⇒ Object
Callback that is being invoked before a document is destroyed.
105 106 107 108 109 |
# File 'lib/arangodb-odm.rb', line 105 def before_destroy(value) self.send(:define_method, 'before_destroy') do value end end |
#before_save(value) ⇒ Object
Callback that is being invoked before a document is updated.
91 92 93 94 95 |
# File 'lib/arangodb-odm.rb', line 91 def before_save(value) self.send(:define_method, 'before_save') do value end end |
#collection(value) ⇒ Object
The collection to use for this document.
50 51 52 53 54 |
# File 'lib/arangodb-odm.rb', line 50 def collection(value) (class << self; self; end).send(:define_method, 'collection') do value.to_s end end |
#db_attrs(*attrs) ⇒ Object
118 119 120 121 122 123 124 |
# File 'lib/arangodb-odm.rb', line 118 def db_attrs(*attrs) @db_attr_names ||= [] @db_attr_names << attrs.collect {|a| a.to_s} if attrs.any? (class << self; self; end).send(:define_method, 'db_attributes') do @db_attr_names ? @db_attr_names.first : [] end end |
#skiplist(*fields) ⇒ Object
56 57 58 59 60 |
# File 'lib/arangodb-odm.rb', line 56 def skiplist(*fields) (class << self; self; end).send(:define_method, 'skiplist') do fields.to_a end end |
#target(value) ⇒ Object
Sets the document value proxy to use.
70 71 72 73 74 |
# File 'lib/arangodb-odm.rb', line 70 def target(value) (class << self; self; end).send(:define_method, 'target') do value end end |
#transport(value) ⇒ Object
Sets the transport class to use. Defaults to httparty.
63 64 65 66 67 |
# File 'lib/arangodb-odm.rb', line 63 def transport(value) (class << self; self; end).send(:define_method, 'transport') do value end end |