Class: BeltsSupport::Configuration::ConfigurationObject

Inherits:
Object
  • Object
show all
Defined in:
lib/belts_support/configuration.rb

Instance Method Summary collapse

Constructor Details

#initializeConfigurationObject

Returns a new instance of ConfigurationObject.



23
24
25
# File 'lib/belts_support/configuration.rb', line 23

def initialize
  @@options ||= {}
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args, &blk) ⇒ Object (private)



33
34
35
36
37
38
39
40
41
# File 'lib/belts_support/configuration.rb', line 33

def method_missing(name, *args, &blk)
  if name.end_with?("=")
    @@options[:"#{name[0..-2]}"] = args.first
  elsif @@options.key?(name)
    @@options[name]
  else
    super
  end
end

Instance Method Details

#respond_to?(name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/belts_support/configuration.rb', line 27

def respond_to?(name, include_private = false)
  super || @@options.key?(name.to_sym)
end