Class: Gemsmith::Gem::ModuleFormatter
- Inherits:
-
Object
- Object
- Gemsmith::Gem::ModuleFormatter
- Defined in:
- lib/gemsmith/gem/module_formatter.rb
Overview
Formats single or multiple modules with correct, two-space indentation for templates.
Instance Method Summary collapse
-
#initialize(namespace) ⇒ ModuleFormatter
constructor
A new instance of ModuleFormatter.
- #render(content) ⇒ Object
Constructor Details
#initialize(namespace) ⇒ ModuleFormatter
Returns a new instance of ModuleFormatter.
11 12 13 14 15 |
# File 'lib/gemsmith/gem/module_formatter.rb', line 11 def initialize namespace @namespace = namespace @modules = namespace.split "::" @depth = namespace.scan("::").length end |
Instance Method Details
#render(content) ⇒ Object
17 18 19 |
# File 'lib/gemsmith/gem/module_formatter.rb', line 17 def render content "#{prefix}#{body content}#{suffix.chomp}" end |