Class: Rubysmith::Renderers::Namespace

Inherits:
Object
  • Object
show all
Defined in:
lib/rubysmith/renderers/namespace.rb

Overview

Renders single or multiple modules with correct, two-space indentation for templates.

Instance Method Summary collapse

Constructor Details

#initialize(namespace, delimiter: "::") ⇒ Namespace

Returns a new instance of Namespace.



11
12
13
14
15
# File 'lib/rubysmith/renderers/namespace.rb', line 11

def initialize namespace, delimiter: "::"
  @namespace = namespace
  @modules = namespace.split delimiter
  @depth = namespace.scan(delimiter).length
end

Instance Method Details

#call(content = nil) ⇒ Object



17
# File 'lib/rubysmith/renderers/namespace.rb', line 17

def call(content = nil) = "#{prefix}#{body content}#{suffix}"