class Sinew::Main
Helper class used by sinew bin. This exists as an independent class solely for testing, otherwise it would be built into the bin script.
Attributes
sinew[R]
Public Class Methods
new(options)
click to toggle source
# File lib/sinew/main.rb, line 7 def initialize(options) options[:output] ||= begin src = options[:recipe] dst = File.join(File.dirname(src), "#{File.basename(src, File.extname(src))}.csv") dst = dst.sub(%r{^./}, '') # nice to clean this up dst end @sinew = Sinew::Base.new(options) end
Public Instance Methods
run()
click to toggle source
# File lib/sinew/main.rb, line 18 def run tm = Time.now header if !sinew.options[:silent] recipe = sinew.options[:recipe] dsl = DSL.new(sinew) begin dsl.instance_eval(File.read(recipe, mode: 'rb'), recipe) rescue LimitError # ignore - this is flow control for --limit end footer(Time.now - tm) if !sinew.options[:silent] end
Protected Instance Methods
header()
click to toggle source
header/footer
# File lib/sinew/main.rb, line 37 def header sinew.banner("Writing to #{sinew.csv.path}...") end