Class: Charming::CLI::ConsoleContext
- Inherits:
-
Object
- Object
- Charming::CLI::ConsoleContext
- Defined in:
- lib/charming/cli.rb
Overview
ConsoleContext is the binding IRB starts in: ‘app` returns a memoized application instance when the app class was resolvable.
Class Method Summary collapse
Instance Method Summary collapse
- #app ⇒ Object
-
#initialize(app_class) ⇒ ConsoleContext
constructor
A new instance of ConsoleContext.
- #start ⇒ Object
Constructor Details
#initialize(app_class) ⇒ ConsoleContext
Returns a new instance of ConsoleContext.
120 121 122 |
# File 'lib/charming/cli.rb', line 120 def initialize(app_class) @app_class = app_class end |
Class Method Details
.start(app_class) ⇒ Object
116 117 118 |
# File 'lib/charming/cli.rb', line 116 def self.start(app_class) new(app_class).start end |
Instance Method Details
#app ⇒ Object
124 125 126 |
# File 'lib/charming/cli.rb', line 124 def app @app ||= @app_class&.new end |
#start ⇒ Object
128 129 130 131 132 |
# File 'lib/charming/cli.rb', line 128 def start IRB.setup(nil) workspace = IRB::WorkSpace.new(binding) IRB::Irb.new(workspace).run(IRB.conf) end |