Class: PG::LogicalReplication::CommandBuilder
- Inherits:
-
Object
- Object
- PG::LogicalReplication::CommandBuilder
- Defined in:
- lib/pg/logical_replication/command_builder.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
Instance Method Summary collapse
- #command_with_options(sql, keyword, options) ⇒ Object
-
#initialize(connection) ⇒ CommandBuilder
constructor
A new instance of CommandBuilder.
Constructor Details
#initialize(connection) ⇒ CommandBuilder
Returns a new instance of CommandBuilder.
8 9 10 |
# File 'lib/pg/logical_replication/command_builder.rb', line 8 def initialize(connection) @connection = connection end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
6 7 8 |
# File 'lib/pg/logical_replication/command_builder.rb', line 6 def connection @connection end |
Instance Method Details
#command_with_options(sql, keyword, options) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/pg/logical_replication/command_builder.rb', line 12 def (sql, keyword, ) raise CommandBuilderError, "Unrecognized keyword #{keyword}" unless ["WITH", "SET"].include?(keyword) if .empty? case keyword when "WITH" return sql when "SET" raise CommandBuilderError, "Keyword SET requires options" end end "#{sql} #{keyword} (#{parameters_list()})" end |