Class: OrientDB::AR::Insert

Inherits:
Object
  • Object
show all
Defined in:
lib/orientdb-ar/sql/insert.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model, command = OrientDB::SQL::Insert.new) ⇒ Insert

Returns a new instance of Insert.



5
6
7
8
# File 'lib/orientdb-ar/sql/insert.rb', line 5

def initialize(model, command = OrientDB::SQL::Insert.new)
  @model, @command = model, command
  @command.oclass model.oclass_name
end

Instance Attribute Details

#commandObject

Returns the value of attribute command.



3
4
5
# File 'lib/orientdb-ar/sql/insert.rb', line 3

def command
  @command
end

#modelObject

Returns the value of attribute model.



3
4
5
# File 'lib/orientdb-ar/sql/insert.rb', line 3

def model
  @model
end

Instance Method Details

#inspectObject Also known as: to_s



21
22
23
# File 'lib/orientdb-ar/sql/insert.rb', line 21

def inspect
  %{#<OrientDB::AR::Insert:#{model.name} command="#{command.to_s}">}
end

#runObject



17
18
19
# File 'lib/orientdb-ar/sql/insert.rb', line 17

def run
  model.connection.run_command command.to_s
end