Class: Tlux::Config::Parser
- Inherits:
-
Object
- Object
- Tlux::Config::Parser
- Defined in:
- lib/tlux/config/parser.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(config) ⇒ Parser
constructor
A new instance of Parser.
- #parse! ⇒ Object
Constructor Details
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
13 14 15 |
# File 'lib/tlux/config/parser.rb', line 13 def config @config end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
13 14 15 |
# File 'lib/tlux/config/parser.rb', line 13 def session @session end |
Class Method Details
.from_file(path) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/tlux/config/parser.rb', line 6 def self.from_file(path) raise Tlux::Config::FileNotFound.new(path) unless File.exists?(path) && File.file?(path) File.open(path, 'r') do |config| self.new(config.read) end end |
Instance Method Details
#parse! ⇒ Object
20 21 22 |
# File 'lib/tlux/config/parser.rb', line 20 def parse! session.instance_eval(config) end |