Sha256: 0ff2735c675d93538f00115d5b221d38affc4cb791f5abd72e755a092a3f67a3
Contents?: true
Size: 570 Bytes
Versions: 30
Compression:
Stored size: 570 Bytes
Contents
# frozen_string_literal: true require 'rails/generators/base' module Mutils # Class SerializerGenerator class SerializerGenerator < Rails::Generators::NamedBase source_root File.expand_path('templates', __dir__) argument :attributes, type: :array, default: [], banner: 'field field' def create_serializer_file template 'serializer.rb.tt', File.join('app', 'serializers', class_path, "#{file_name}_serializer.rb") end private def attributes_names attributes.map { |attribute| attribute.name.to_sym.inspect } end end end
Version data entries
30 entries across 30 versions & 1 rubygems