Class: Exwiw::AfterInsertHook::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/exwiw/after_insert_hook.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(cli_options) ⇒ Context

Returns a new instance of Context.



52
53
54
55
# File 'lib/exwiw/after_insert_hook.rb', line 52

def initialize(cli_options)
  @cli_options = cli_options
  @collected = []
end

Instance Attribute Details

#cli_optionsObject (readonly)

Returns the value of attribute cli_options.



50
51
52
# File 'lib/exwiw/after_insert_hook.rb', line 50

def cli_options
  @cli_options
end

#collectedObject (readonly)

Returns the value of attribute collected.



50
51
52
# File 'lib/exwiw/after_insert_hook.rb', line 50

def collected
  @collected
end

Instance Method Details

#insert_sql(template) ⇒ Object Also known as: insert_jsonl



57
58
59
# File 'lib/exwiw/after_insert_hook.rb', line 57

def insert_sql(template)
  @collected << ERB.new(template, trim_mode: '-').result(binding)
end