module Gemsmith::Helpers::Template

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.

Public Instance Methods

gem_class() click to toggle source
# File lib/gemsmith/helpers/template.rb, line 16
def gem_class
  configuration.dig :gem, :class
end
gem_name() click to toggle source
# File lib/gemsmith/helpers/template.rb, line 8
def gem_name
  configuration.dig :gem, :name
end
gem_path() click to toggle source
# File lib/gemsmith/helpers/template.rb, line 12
def gem_path
  configuration.dig :gem, :path
end
rails_version() click to toggle source
# File lib/gemsmith/helpers/template.rb, line 20
def rails_version
  configuration.dig :versions, :rails
end
render_namespace(&block) click to toggle source
# File lib/gemsmith/helpers/template.rb, line 24
def render_namespace &block
  body = capture(&block) if block
  concat Gem::ModuleFormatter.new(gem_class).render(body)
end