Class: Csv2Psql::ErbHelper
- Inherits:
-
Object
- Object
- Csv2Psql::ErbHelper
- Defined in:
- lib/csv2psql/helpers/erb_helper.rb
Overview
ERB Helper
Constant Summary collapse
- BASE_DIR =
File.join(File.dirname(__FILE__), '..')
Instance Method Summary collapse
Instance Method Details
#process(filename, ctx = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/csv2psql/helpers/erb_helper.rb', line 16 def process(filename, ctx = {}) ctx ||= {} # rubocop:disable Lint/UselessAssignment b = binding erb = ERB.new(File.read(filename), 0, '>') erb.filename = filename erb.result b end |
#render(filename) ⇒ Object
11 12 13 14 |
# File 'lib/csv2psql/helpers/erb_helper.rb', line 11 def render(filename) path = File.join(BASE_DIR, filename) File.read(path) end |
#run ⇒ Object
24 25 26 27 28 |
# File 'lib/csv2psql/helpers/erb_helper.rb', line 24 def run FILES.each do |files| process(files) end end |