Sha256: 079fa2d78c9a5ce8a93d82b883d6d3113cdbcf30dfb43326a3cef5e931588171
Contents?: true
Size: 896 Bytes
Versions: 71
Compression:
Stored size: 896 Bytes
Contents
# frozen_string_literal: true require_relative "../../lib/plutonium_generators" module Pu module Field class RendererGenerator < Rails::Generators::Base include PlutoniumGenerators::Generator source_root File.expand_path("templates", __dir__) desc "Generates a field renderer" argument :name def start in_root do template "renderer.rb", "app/plutonium/fields/renderers/#{name.underscore}_renderer.rb" insert_into_file "config/initializers/plutonium.rb", registration_statement, after: /.*# Register components here.*\n/ end rescue => e exception "#{self.class} failed:", e end private def registration_statement indent "Plutonium::Core::Fields::Renderers::Factory.map_type :#{name.underscore}, to: Fields::Renderers::#{name.camelize}Renderer\n", 2 end end end end
Version data entries
71 entries across 71 versions & 1 rubygems