Class: Sinew::Main
- Inherits:
-
Object
- Object
- Sinew::Main
- Defined in:
- lib/sinew/main.rb
Overview
Helper class used by sinew bin. This exists as an independent class solely for testing, otherwise it would be built into the bin script.
Defined Under Namespace
Classes: DSL
Instance Attribute Summary collapse
-
#sinew ⇒ Object
readonly
Returns the value of attribute sinew.
Instance Method Summary collapse
-
#initialize(options) ⇒ Main
constructor
A new instance of Main.
- #run ⇒ Object
Constructor Details
#initialize(options) ⇒ Main
Returns a new instance of Main.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/sinew/main.rb', line 7 def initialize() [:output] ||= begin src = [: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() end |
Instance Attribute Details
#sinew ⇒ Object (readonly)
Returns the value of attribute sinew.
5 6 7 |
# File 'lib/sinew/main.rb', line 5 def sinew @sinew end |
Instance Method Details
#run ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sinew/main.rb', line 18 def run tm = Time.now header if !sinew.[:silent] recipe = sinew.[: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 (Time.now - tm) if !sinew.[:silent] end |