Class: PGTrunk::Operation::RubyBuilder
- Inherits:
-
Object
- Object
- PGTrunk::Operation::RubyBuilder
- Defined in:
- lib/pg_trunk/core/operation/ruby_builder.rb
Overview
Build ruby snippet
Instance Method Summary collapse
-
#build ⇒ String
Build the snippet.
-
#ruby_line(meth, *args, **opts) ⇒ Object
Add line into a block.
-
#ruby_param(*args, **opts) ⇒ Object
Add parameters to the method call.
Instance Method Details
#build ⇒ String
Build the snippet
31 32 33 |
# File 'lib/pg_trunk/core/operation/ruby_builder.rb', line 31 def build [header, *block].join(" ") end |
#ruby_line(meth, *args, **opts) ⇒ Object
Add line into a block
22 23 24 25 26 27 |
# File 'lib/pg_trunk/core/operation/ruby_builder.rb', line 22 def ruby_line(meth, *args, **opts) return if meth.blank? return if args.first.nil? @lines << build_line(meth, *args, **opts) end |
#ruby_param(*args, **opts) ⇒ Object
Add parameters to the method call
16 17 18 19 |
# File 'lib/pg_trunk/core/operation/ruby_builder.rb', line 16 def ruby_param(*args, **opts) @args = [*@args, *params(*args)] @opts = [*@opts, *params(**opts)] end |