Class: It::Plain

Inherits:
Tag
  • Object
show all
Defined in:
lib/it/plain.rb

Overview

Handles replacements in non HTML templates (e.g. mails)

Instance Attribute Summary

Attributes inherited from Tag

#options, #tag_name

Instance Method Summary collapse

Constructor Details

#initialize(template = '%s') ⇒ Plain

Returns a new instance of Plain.

Raises:

  • (TypeError)


4
5
6
7
8
# File 'lib/it/plain.rb', line 4

def initialize(template = '%s')
  raise TypeError, "expected a String, got #{template.class}" unless template.is_a?(String)

  @template = template
end

Instance Method Details

#process(content = '') ⇒ Object



10
11
12
# File 'lib/it/plain.rb', line 10

def process(content = '')
  format(@template, content)
end