Class: ActiveRecordUpsert::Arel::InsertManager::OnDuplicate
- Inherits:
-
Arel::Nodes::Node
- Object
- Arel::Nodes::Node
- ActiveRecordUpsert::Arel::InsertManager::OnDuplicate
- Defined in:
- lib/active_record_upsert/arel/insert_manager.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
Returns the value of attribute columns.
Instance Method Summary collapse
-
#expr ⇒ Object
rubocop:disable Metrics/MethodLength.
-
#initialize(expr, columns) ⇒ OnDuplicate
constructor
A new instance of OnDuplicate.
Constructor Details
#initialize(expr, columns) ⇒ OnDuplicate
Returns a new instance of OnDuplicate.
11 12 13 14 |
# File 'lib/active_record_upsert/arel/insert_manager.rb', line 11 def initialize(expr, columns) @expr = expr @columns = columns end |
Instance Attribute Details
#columns ⇒ Object
Returns the value of attribute columns.
9 10 11 |
# File 'lib/active_record_upsert/arel/insert_manager.rb', line 9 def columns @columns end |
Instance Method Details
#expr ⇒ Object
rubocop:disable Metrics/MethodLength
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/active_record_upsert/arel/insert_manager.rb', line 16 def expr # rubocop:disable Metrics/MethodLength case @expr when nil eq(first_col, first_col) when String sql(@expr) when Hash @expr.map do |key, val| eq(sql(key.to_s), sql(val)) end else @expr end end |