Class: Blade::Config

Inherits:
ActiveSupport::HashWithIndifferentAccess
  • Object
show all
Defined in:
lib/blade/config.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/blade/config.rb', line 2

def method_missing(method, *args)
  case method
  when /=$/
    self[$`] = args.first
  when /\?$/
    self[$`].present?
  else
    if self[method].is_a?(Hash) && !self[method].is_a?(self.class)
      self[method] = self.class.new(self[method])
    end
    self[method]
  end
end