Class: Bcome::WorkspaceContext
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #has_object? ⇒ Boolean
- #irb_prompt ⇒ Object
- #is_sudo? ⇒ Boolean
- #set(object, current_object, spawn = true) ⇒ Object
- #spawn_for_object(object) ⇒ Object
- #start_prompt ⇒ Object
Instance Attribute Details
#object ⇒ Object (readonly)
Returns the value of attribute object.
3 4 5 |
# File 'lib/workspace_context.rb', line 3 def object @object end |
Instance Method Details
#has_object? ⇒ Boolean
24 25 26 |
# File 'lib/workspace_context.rb', line 24 def has_object? !self.object.nil? end |
#irb_prompt ⇒ Object
32 33 34 |
# File 'lib/workspace_context.rb', line 32 def irb_prompt @object ? @object.send(:become_identifier) : start_prompt end |
#is_sudo? ⇒ Boolean
36 37 38 |
# File 'lib/workspace_context.rb', line 36 def is_sudo? @object.is_sudo? end |
#set(object, current_object, spawn = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/workspace_context.rb', line 5 def set(object, current_object, spawn = true) @object = object main_context = IRB.conf[:MAIN_CONTEXT] @object.main_context = main_context.workspace if main_context @object.previous_workspace_object = current_object if current_object # Spawn is initiated when a user wants to shift workspace context. # We don't spawn whilst setting up the hierarchy for quick contexts spawn_for_object(@object) if spawn return end |
#spawn_for_object(object) ⇒ Object
18 19 20 21 22 |
# File 'lib/workspace_context.rb', line 18 def spawn_for_object(object) require 'irb/ext/multi-irb' IRB.parse_opts_with_ignoring_script IRB.irb nil, @object end |
#start_prompt ⇒ Object
28 29 30 |
# File 'lib/workspace_context.rb', line 28 def start_prompt ::START_PROMPT end |