Class: Bcome::WorkspaceContext
Overview
TODO Move to include
Instance Attribute Summary collapse
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #has_object? ⇒ Boolean
- #irb_prompt ⇒ Object
- #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
25 26 27 |
# File 'lib/workspace_context.rb', line 25 def has_object? !self.object.nil? end |
#irb_prompt ⇒ Object
33 34 35 |
# File 'lib/workspace_context.rb', line 33 def irb_prompt @object ? @object.send(:become_identifier) : start_prompt end |
#set(object, current_object, spawn = true) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# 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 irb = IRB::Irb.new(IRB::WorkSpace.new(@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 end |
#spawn_for_object(object) ⇒ Object
19 20 21 22 23 |
# File 'lib/workspace_context.rb', line 19 def spawn_for_object(object) require 'irb/ext/multi-irb' IRB.parse_opts_with_ignoring_script IRB.irb nil, @object end |
#start_prompt ⇒ Object
29 30 31 |
# File 'lib/workspace_context.rb', line 29 def start_prompt ::START_PROMPT end |