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.
132 133 134 |
# File 'lib/charming/cli.rb', line 132 def initialize(app_class) @app_class = app_class end |
Class Method Details
.start(app_class) ⇒ Object
128 129 130 |
# File 'lib/charming/cli.rb', line 128 def self.start(app_class) new(app_class).start end |
Instance Method Details
#app ⇒ Object
136 137 138 |
# File 'lib/charming/cli.rb', line 136 def app @app ||= @app_class&.new end |
#start ⇒ Object
140 141 142 143 144 |
# File 'lib/charming/cli.rb', line 140 def start IRB.setup(nil) workspace = IRB::WorkSpace.new(binding) IRB::Irb.new(workspace).run(IRB.conf) end |