Sha256: e067be95fa352679d8aea1d89aceb4fdba10759de4903074be4aed64a4136009
Contents?: true
Size: 857 Bytes
Versions: 3
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true require_relative '../../ability_definition' module Canard module Generators class AbilityGenerator < Rails::Generators::NamedBase # :nodoc: source_root File.expand_path('templates', __dir__) argument :ability_definitions, type: :array, default: [], banner: 'can:[read,update]:[user,account] cannot:[create,destroy]:user' def generate_ability template 'abilities.rb.erb', Abilities.default_path + "/#{file_name.pluralize}.rb" end hook_for :test_framework, as: 'ability' private def definitions ability_definitions.each { |definition| AbilityDefinition.parse(definition) } AbilityDefinition.models.sort.each do |model, definition| yield model, definition end end end end end
Version data entries
3 entries across 3 versions & 1 rubygems