Class: Mysh::Keeper

Inherits:
Object show all
Defined in:
lib/mysh/shell_variables/shell_variable_keeper.rb

Overview

The keeper of mysh variable values.

Instance Method Summary collapse

Constructor Details

#initialize(value = "") ⇒ Keeper

Set up this variable



10
11
12
# File 'lib/mysh/shell_variables/shell_variable_keeper.rb', line 10

def initialize(value="")
  @value = value
end

Instance Method Details

#get_sourceObject

Get the source code of this variable.



25
26
27
# File 'lib/mysh/shell_variables/shell_variable_keeper.rb', line 25

def get_source
  @value
end

#get_value(loop_check = {}) ⇒ Object

Get the value of this variable.



15
16
17
18
19
20
21
22
# File 'lib/mysh/shell_variables/shell_variable_keeper.rb', line 15

def get_value(loop_check={})
  my_id = self.object_id
  fail "Mysh variable looping error." if loop_check[my_id]
  loop_check[my_id] = self
  @value.preprocess
ensure
  loop_check.delete(my_id)
end

#set_value(value) ⇒ Object

Set the value of this variable.



30
31
32
# File 'lib/mysh/shell_variables/shell_variable_keeper.rb', line 30

def set_value(value)
  @value = value
end