Sha256: 91dfb67cddc4e299637af6be41ad4255d1f445d84b26b5576fce53a6a2767940
Contents?: true
Size: 549 Bytes
Versions: 2
Compression:
Stored size: 549 Bytes
Contents
require 'rails/generators' module Masina class PolicyGenerator < Rails::Generators::NamedBase source_root File.expand_path('templates', __dir__) argument :methods, type: :array, default: [], banner: 'method method' def create_policy_file policy_dir_path = 'app/policies' generator_path = policy_dir_path + "/#{file_name}_policy.rb" Dir.mkdir(policy_dir_path) unless File.exist?(policy_dir_path) template 'policy.erb', generator_path end private def methods? methods.any? end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
masina-0.1.9 | lib/generators/masina/policy/policy_generator.rb |
masina-0.1.8 | lib/generators/masina/policy/policy_generator.rb |