Module: Gemsmith::Helpers::Template
- Included in:
- CLI
- Defined in:
- lib/gemsmith/helpers/template.rb
Overview
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.
Instance Method Summary collapse
- #gem_class ⇒ Object
- #gem_name ⇒ Object
- #gem_path ⇒ Object
- #rails_version ⇒ Object
- #render_namespace(&block) ⇒ Object
Instance Method Details
#gem_class ⇒ Object
16 17 18 |
# File 'lib/gemsmith/helpers/template.rb', line 16 def gem_class configuration.dig :gem, :class end |
#gem_name ⇒ Object
8 9 10 |
# File 'lib/gemsmith/helpers/template.rb', line 8 def gem_name configuration.dig :gem, :name end |
#gem_path ⇒ Object
12 13 14 |
# File 'lib/gemsmith/helpers/template.rb', line 12 def gem_path configuration.dig :gem, :path end |
#rails_version ⇒ Object
20 21 22 |
# File 'lib/gemsmith/helpers/template.rb', line 20 def rails_version configuration.dig :versions, :rails end |
#render_namespace(&block) ⇒ Object
24 25 26 27 |
# File 'lib/gemsmith/helpers/template.rb', line 24 def render_namespace &block body = capture(&block) if block_given? concat Gem::ModuleFormatter.new(gem_class).render(body) end |