Class: Stylish::Configuration
- Inherits:
-
Object
- Object
- Stylish::Configuration
show all
- Includes:
- Singleton
- Defined in:
- lib/stylish/configuration.rb
Constant Summary
collapse
- Defaults =
{}
Class Method Summary
collapse
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
21
22
23
24
|
# File 'lib/stylish/configuration.rb', line 21
def method_missing(meth, *args, &block)
return current[meth] if current.key?(meth)
super
end
|
Class Method Details
.method_missing(meth, *args, &block) ⇒ Object
7
8
9
10
11
12
13
14
15
|
# File 'lib/stylish/configuration.rb', line 7
def self.method_missing(meth, *args, &block)
binding.pry
if instance.respond_to?(meth)
return instance.send meth, *args, &block
end
nil
end
|
Instance Method Details
#apply(object = {}) ⇒ Object
26
27
28
|
# File 'lib/stylish/configuration.rb', line 26
def apply(object={})
current.tap {|c| c.merge!(object) }
end
|
#current ⇒ Object
34
35
36
37
38
39
40
41
|
# File 'lib/stylish/configuration.rb', line 34
def current
@current ||= Hashie::Mash.new(Defaults).tap do |c|
ENV.each do |key, value|
key = key.to_s.downcase.to_sym
c[key] = value
end
end
end
|
#public ⇒ Object
30
31
32
|
# File 'lib/stylish/configuration.rb', line 30
def public
current.slice(:library_path)
end
|
#respond_to?(*args) ⇒ Boolean
17
18
19
|
# File 'lib/stylish/configuration.rb', line 17
def respond_to?(*args)
current.send(:key?, args.first) || current.send(:respond_to?, *args)
end
|