class CantCantCant::Generators::InstallGenerator

Public Instance Methods

create_config_file() click to toggle source
# File lib/generators/cant_cant_cant/install/install_generator.rb, line 9
def create_config_file
  template 'config.yml', 'config/cant_cant_cant.yml'
end
create_initializer_file() click to toggle source
# File lib/generators/cant_cant_cant/install/install_generator.rb, line 13
def create_initializer_file
  template 'initializer.rb', 'config/initializers/cant_cant_cant.rb'
end

Private Instance Methods

user_params() click to toggle source
# File lib/generators/cant_cant_cant/install/install_generator.rb, line 19
def user_params
  routes = Rails.application.routes.routes.to_a
  routes.reject! { |x| x.defaults[:internal] }
  routes.map(&:defaults).reject(&:empty?).uniq
end
user_permission_table() click to toggle source
# File lib/generators/cant_cant_cant/install/install_generator.rb, line 25
def user_permission_table
  map = {}
  user_params.each do |p|
    key = "#{p[:controller]}##{p[:action]}"
    map[key] = :deny
  end
  map
end