Class: CanTango::Config::Permits::Key

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/cantango/permits_ext/config/permits/key.rb

Instance Method Summary collapse

Instance Method Details

#create_for(ability) ⇒ Object



10
11
12
# File 'lib/cantango/permits_ext/config/permits/key.rb', line 10

def create_for ability
  ability.respond_to?(:subject) ? maker.create_for(ability) : maker.new(ability)
end

#hash_for(ability) ⇒ Object



6
7
8
# File 'lib/cantango/permits_ext/config/permits/key.rb', line 6

def hash_for ability
  create_for(ability).value
end

#makerObject



14
15
16
# File 'lib/cantango/permits_ext/config/permits/key.rb', line 14

def maker
  CanTango::Ability::Cache::SimpleKey
end