Sha256: c69815e1dbf2175e786061350f156f5106fb1d2a4171da00bc35ce993d813947

Contents?: true

Size: 846 Bytes

Versions: 3

Compression:

Stored size: 846 Bytes

Contents

# -*- encoding : utf-8 -*-

require "generators/card"

class Card
  module Generators
    class FormatGenerator < NamedBase
      source_root File.expand_path("templates", __dir__)

      argument :module_name, required: true
      class_option "core", type: :boolean, aliases: "-c",
                           default: false, group: :runtime,
                           desc: "create format files in Card gem"

      def create_files
        template "format_template.erb", format_path
        template "format_spec_template.erb", format_path("spec")
      end

      private

      def format_path modifier=nil
        suffix = modifier ? "_#{modifier}" : nil
        filename = "#{module_name}_format#{suffix}.rb"
        path_parts = [mod_path, modifier, "format", filename].compact
        File.join(*path_parts)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
card-1.101.7 lib/generators/card/format/format_generator.rb
card-1.101.6 lib/generators/card/format/format_generator.rb
card-1.101.5 lib/generators/card/format/format_generator.rb