Class: Jabara::MySQL::Output
- Inherits:
-
Object
- Object
- Jabara::MySQL::Output
- Defined in:
- lib/jabara/mysql/output.rb
Direct Known Subclasses
Instance Method Summary collapse
- #encode(object_repr) ⇒ Object
-
#initialize(null_value: 'null') ⇒ Output
constructor
A new instance of Output.
Constructor Details
#initialize(null_value: 'null') ⇒ Output
Returns a new instance of Output.
7 8 9 |
# File 'lib/jabara/mysql/output.rb', line 7 def initialize(null_value:'null') @null_value = null_value end |
Instance Method Details
#encode(object_repr) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/jabara/mysql/output.rb', line 11 def encode(object_repr) table_name = ::.object_type(object_repr) mysql_value_hash = {} ::.data(object_repr).each do |key, repr| mysql_value_hash[key] = mysql_value(repr) end build_insert_query(table_name, mysql_value_hash) end |