Sha256: 31825526a7017046938ef79dbab7909518cb29a86476b2f93665ec2be5d320a3
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
class RegisterErrorGenerator < Rails::Generators::Base desc 'This generator creates a register_error statement to include in your code' class_option :name, type: :string, default: 'ErrorName' class_option :type, type: :string, default: 'ParentClass' def register_error Zeitwerk::Loader.eager_load_all name = options['name'].camelcase type = options['type'].camelcase harness = NxtErrorRegistry::CodesHarness.instance code = harness.generate_code puts '----------------------------------------------' puts "register_error :#{name}, type: #{type}, code: '#{code}'" puts '----------------------------------------------' end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nxt_error_registry-0.3.0 | lib/generators/register_error_generator.rb |