Class: AmsLayout::Runner
- Inherits:
-
Object
- Object
- AmsLayout::Runner
- Defined in:
- lib/ams_layout.rb
Instance Method Summary collapse
- #execute! ⇒ Object
-
#initialize(argv, client = AmsLayout::Client.new, exit_code = true) ⇒ Runner
constructor
A new instance of Runner.
Constructor Details
#initialize(argv, client = AmsLayout::Client.new, exit_code = true) ⇒ Runner
Returns a new instance of Runner.
160 161 162 163 164 |
# File 'lib/ams_layout.rb', line 160 def initialize(argv, client = AmsLayout::Client.new, exit_code = true) @argv = argv AmsLayout.client = client @exit_code = exit_code end |
Instance Method Details
#execute! ⇒ Object
166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/ams_layout.rb', line 166 def execute! exit_code = begin # Run the thor app AmsLayout::CLI.start(@argv) # Thor::Base#start does not have a return value, # assume success if no exception is thrown. 0 rescue StandardError => e b = e.backtrace b.unshift("#{b.shift}: #{e.message} (#{e.class})") puts(b.map { |s| "\tfrom #{s}"}.join("\n")) 1 end # Return the exit code exit(exit_code) if @exit_code end |