Class: ShellContext
- Inherits:
-
Object
- Object
- ShellContext
- Defined in:
- lib/context.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#commands ⇒ Object
Returns the value of attribute commands.
-
#config ⇒ Object
Returns the value of attribute config.
-
#config_path ⇒ Object
Returns the value of attribute config_path.
-
#deep ⇒ Object
Returns the value of attribute deep.
-
#sysbh ⇒ Object
Returns the value of attribute sysbh.
Instance Method Summary collapse
-
#initialize(user, config_path, argv_token) ⇒ ShellContext
constructor
A new instance of ShellContext.
- #prompt ⇒ Object
Constructor Details
#initialize(user, config_path, argv_token) ⇒ ShellContext
Returns a new instance of ShellContext.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/context.rb', line 13 def initialize(user, config_path, argv_token) @commands = {} @config_path = config_path @sysbh = Sys.new @sysbh.write_initial_memory if !user.nil? @config = @sysbh.load_config_user(config_path, user) @client = @sysbh.client @deep = User else @config = @sysbh.load_config(config_path, argv_token) # retorna la configuracion ya guardada anteriormente @client = @sysbh.client @deep = @sysbh.return_deep(config_path) end @sysbh.load_memory(config_path, @config) unless @client.nil? @sysbh.add_history_str(2, Organization.new.read_orgs(@client)) end # let commands class access context variables share_context = Commands.new share_context.load_enviroment(self) @commands = COMMANDS end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
8 9 10 |
# File 'lib/context.rb', line 8 def client @client end |
#commands ⇒ Object
Returns the value of attribute commands.
10 11 12 |
# File 'lib/context.rb', line 10 def commands @commands end |
#config ⇒ Object
Returns the value of attribute config.
7 8 9 |
# File 'lib/context.rb', line 7 def config @config end |
#config_path ⇒ Object
Returns the value of attribute config_path.
11 12 13 |
# File 'lib/context.rb', line 11 def config_path @config_path end |
#deep ⇒ Object
Returns the value of attribute deep.
6 7 8 |
# File 'lib/context.rb', line 6 def deep @deep end |
#sysbh ⇒ Object
Returns the value of attribute sysbh.
9 10 11 |
# File 'lib/context.rb', line 9 def sysbh @sysbh end |
Instance Method Details
#prompt ⇒ Object
39 40 41 |
# File 'lib/context.rb', line 39 def prompt @deep.shell_prompt(@config) end |