Sha256: 00aded34f586702ed79fd02c6caf48907cbe5a127f20e7af97beb0c7f6e03045

Contents?: true

Size: 719 Bytes

Versions: 11

Compression:

Stored size: 719 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  module Helpers
    # Provides Thor CLI helper methods. 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
        concat Gem::ModuleFormatter.new(gem_class).render(body)
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
gemsmith-15.5.0 lib/gemsmith/helpers/template.rb
gemsmith-15.4.0 lib/gemsmith/helpers/template.rb
gemsmith-15.3.0 lib/gemsmith/helpers/template.rb
gemsmith-15.2.0 lib/gemsmith/helpers/template.rb
gemsmith-15.1.1 lib/gemsmith/helpers/template.rb
gemsmith-15.1.0 lib/gemsmith/helpers/template.rb
gemsmith-15.0.0 lib/gemsmith/helpers/template.rb
gemsmith-14.11.0 lib/gemsmith/helpers/template.rb
gemsmith-14.10.1 lib/gemsmith/helpers/template.rb
gemsmith-14.10.0 lib/gemsmith/helpers/template.rb
gemsmith-14.9.0 lib/gemsmith/helpers/template.rb