Class: QuickAndRuby::Data::Browser
- Inherits:
-
Object
- Object
- QuickAndRuby::Data::Browser
- Defined in:
- lib/quick_and_ruby/data/browser.rb
Instance Attribute Summary collapse
-
#root_context ⇒ Object
readonly
Returns the value of attribute root_context.
Instance Method Summary collapse
-
#initialize(root_context) ⇒ Browser
constructor
A new instance of Browser.
- #main ⇒ Object
Constructor Details
#initialize(root_context) ⇒ Browser
Returns a new instance of Browser.
10 11 12 |
# File 'lib/quick_and_ruby/data/browser.rb', line 10 def initialize(root_context) @root_context = root_context end |
Instance Attribute Details
#root_context ⇒ Object (readonly)
Returns the value of attribute root_context.
8 9 10 |
# File 'lib/quick_and_ruby/data/browser.rb', line 8 def root_context @root_context end |
Instance Method Details
#main ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/quick_and_ruby/data/browser.rb', line 14 def main command = nil current_context = root_context Reline.completion_proc = lambda { |input| current_context.completions(input) } while command != 'exit' command = Reline.readline("#{current_context.pwd}> ", true) break if command.nil? current_context = execute_command(command.strip, current_context) end end |