Class: CanTango::Configuration::Permits

Inherits:
PermitRegistry show all
Includes:
Singleton
Defined in:
lib/cantango/configuration/permits.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



17
18
19
# File 'lib/cantango/configuration/permits.rb', line 17

def method_missing method_name, *args
  accounts[method_name] ||= PermitRegistry.new
end

Instance Attribute Details

#accountsObject (readonly)



9
10
11
# File 'lib/cantango/configuration/permits.rb', line 9

def accounts
  @accounts
end

Instance Method Details

#account_hash(name) ⇒ Object



13
14
15
# File 'lib/cantango/configuration/permits.rb', line 13

def  name
  accounts[name]
end

#register_permit_class(permit_name, permit_clazz, permit_type, account_name) ⇒ Object



21
22
23
24
# File 'lib/cantango/configuration/permits.rb', line 21

def register_permit_class(permit_name, permit_clazz, permit_type, )
  registry =  ? self.send(.to_sym) : self
  registry.send(permit_type)[permit_name] = permit_clazz
end