Class: Reader
- Inherits:
-
Object
- Object
- Reader
- Defined in:
- lib/read_config.rb
Instance Attribute Summary collapse
-
#color ⇒ Object
readonly
Returns the value of attribute color.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#prompt ⇒ Object
readonly
Returns the value of attribute prompt.
Instance Method Summary collapse
-
#initialize ⇒ Reader
constructor
A new instance of Reader.
- #setcolor(arg1, arg2) ⇒ Object
- #setpath(str) ⇒ Object
- #setprompt(str) ⇒ Object
Constructor Details
#initialize ⇒ Reader
Returns a new instance of Reader.
5 6 7 8 9 |
# File 'lib/read_config.rb', line 5 def initialize @path = ["/bin"] @prompt = "$ " @color = {"prompt" => 'white', "great" => 'red', "miss" => 'blue'} end |
Instance Attribute Details
#color ⇒ Object (readonly)
Returns the value of attribute color.
4 5 6 |
# File 'lib/read_config.rb', line 4 def color @color end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
4 5 6 |
# File 'lib/read_config.rb', line 4 def path @path end |
#prompt ⇒ Object (readonly)
Returns the value of attribute prompt.
4 5 6 |
# File 'lib/read_config.rb', line 4 def prompt @prompt end |
Instance Method Details
#setcolor(arg1, arg2) ⇒ Object
23 24 25 |
# File 'lib/read_config.rb', line 23 def setcolor(arg1, arg2) @color[arg1] = arg2 end |
#setpath(str) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/read_config.rb', line 11 def setpath(str) if str.index(':') @path = str.split(':') else @path = [str] end end |
#setprompt(str) ⇒ Object
19 20 21 |
# File 'lib/read_config.rb', line 19 def setprompt(str) @prompt = str end |