Sha256: e89ce25129d156f9d7bd8ec5f841b39d592c1de1e73221948982c47447ef49cb

Contents?: true

Size: 741 Bytes

Versions: 2

Compression:

Stored size: 741 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module Helpers
    # Provides helper methods for use by the Thor CLI. These methods are necessary to resolve %% file
    # and folder variables and render dynamic content within the Thor ERB *templates* structure.
    module Template
      def gem_name
        configuration.dig :gem, :name
      end

      def gem_path
        configuration.dig :gem, :path
      end

      def gem_class
        configuration.dig :gem, :class
      end

      def rails_version
        configuration.dig :versions, :rails
      end

      def render_namespace &block
        body = capture(&block) if block_given?
        concat Gem::ModuleFormatter.new(gem_class).render(body)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gemsmith-8.2.0 lib/gemsmith/helpers/template.rb
gemsmith-8.1.0 lib/gemsmith/helpers/template.rb