Class: Runfile::Entrypoint
- Inherits:
-
Object
- Object
- Runfile::Entrypoint
- Includes:
- Colsole, Inspectable, Renderable
- Defined in:
- lib/runfile/entrypoint.rb
Overview
Serves as the initial entrypoint when running run
.
Instance Attribute Summary collapse
-
#argv ⇒ Object
readonly
Returns the value of attribute argv.
Instance Method Summary collapse
- #handler ⇒ Object
-
#initialize(argv = ARGV) ⇒ Entrypoint
constructor
A new instance of Entrypoint.
- #inspectable ⇒ Object
- #run ⇒ Object
- #run! ⇒ Object
Methods included from Renderable
Methods included from Inspectable
Constructor Details
#initialize(argv = ARGV) ⇒ Entrypoint
Returns a new instance of Entrypoint.
10 11 12 |
# File 'lib/runfile/entrypoint.rb', line 10 def initialize(argv = ARGV) @argv = argv end |
Instance Attribute Details
#argv ⇒ Object (readonly)
Returns the value of attribute argv.
8 9 10 |
# File 'lib/runfile/entrypoint.rb', line 8 def argv @argv end |
Instance Method Details
#handler ⇒ Object
14 15 16 |
# File 'lib/runfile/entrypoint.rb', line 14 def handler rootfile || Initiator.new end |
#inspectable ⇒ Object
18 19 20 |
# File 'lib/runfile/entrypoint.rb', line 18 def inspectable { argv: argv } end |
#run ⇒ Object
22 23 24 |
# File 'lib/runfile/entrypoint.rb', line 22 def run handler.run argv end |
#run! ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/runfile/entrypoint.rb', line 26 def run! run rescue Runfile::ExitWithUsage => e say e. e.exit_code rescue Runfile::UserError => e allow_debug e say! "mib` #{e.class} `" say! e. 1 rescue Interrupt say! 'm`Goodbye`', replace: true 1 rescue => e allow_debug e say! "rib` #{e.class} ` in nu`#{origin(e)}`" say! e. say! "\nPrefix with nu`DEBUG=1` for full backtrace" unless ENV['DEBUG'] 1 end |