Module: Mycrm::Domains::Rescuer

Defined in:
lib/mycrm/domains.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

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



14
15
16
17
# File 'lib/mycrm/domains.rb', line 14

def method_missing(name, *args, &block)
  return super unless constant?(name)
  create_constant(name)
end

Instance Method Details

#[](label) ⇒ Object Also known as: find

Raises:

  • (NameError)


5
6
7
8
9
# File 'lib/mycrm/domains.rb', line 5

def [](label)
  name = label.downcase.gsub(/\W/, '_')
  raise NameError, "#{label} is not a valid domain" unless constant?(name)
  create_constant(name)
end