Sha256: 41308fe020a354f00a7c8f93d413cb4ec5b27f4b6b37c66e5949b9221b85c2d5

Contents?: true

Size: 684 Bytes

Versions: 1

Compression:

Stored size: 684 Bytes

Contents

# frozen_string_literal: true

module Gemsmith
  # 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 TemplateHelper
    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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gemsmith-8.0.0 lib/gemsmith/template_helper.rb