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.



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

def get_source
  @value
end

#get_value(loop_check = {}) ⇒ Object

Get the value of this variable.



15
16
17
18
19
20
21
# 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
end

#set_value(value) ⇒ Object

Set the value of this variable.



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

def set_value(value)
  @value = value
end