Class: Slideshift::Tool::Config
- Inherits:
-
Object
- Object
- Slideshift::Tool::Config
show all
- Defined in:
- lib/slideshift/tool/config.rb
Instance Method Summary
collapse
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13
14
15
|
# File 'lib/slideshift/tool/config.rb', line 13
def initialize
@config = {}
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args) ⇒ Object
29
30
31
32
33
34
35
|
# File 'lib/slideshift/tool/config.rb', line 29
def method_missing(name, *args)
if name =~ /=$/
@config[name.to_s.sub('=', '').to_sym] = args.first
else
@config[name.to_s.to_sym] ||= self.class.new
end
end
|
Instance Method Details
#[](name) ⇒ Object
21
22
23
|
# File 'lib/slideshift/tool/config.rb', line 21
def [](name)
@config[name.to_s.to_sym]
end
|
#[]=(name, value) ⇒ Object
25
26
27
|
# File 'lib/slideshift/tool/config.rb', line 25
def []=(name, value)
@config[name.to_s.to_sym] = value
end
|
#inspect ⇒ Object
37
38
39
|
# File 'lib/slideshift/tool/config.rb', line 37
def inspect
@config.inspect
end
|
#read(file) ⇒ Object
17
18
19
|
# File 'lib/slideshift/tool/config.rb', line 17
def read(file)
ERB.new("<% #{File.read(file)} %>").result(binding)
end
|