Module: Trenni::Markup

Included in:
Builder, MarkupString
Defined in:
lib/trenni/markup.rb

Overview

A wrapper which indicates that ‘value` can be appended to the output buffer without any changes.

Constant Summary collapse

EMPTY =
String.new.extend(Markup).freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.escape(value) ⇒ Object

Generates a string suitable for concatenating with the output buffer.



27
28
29
30
31
32
33
34
35
36
# File 'lib/trenni/markup.rb', line 27

def self.escape(value)
	if value.is_a? Markup
		value
	elsif value
		MarkupString.new(value.to_s)
	else
		# String#<< won't accept nil, so we return an empty string, thus ensuring a fixed point function:
		EMPTY
	end
end

Instance Method Details

#escape(value) ⇒ Object



38
39
40
# File 'lib/trenni/markup.rb', line 38

def escape(value)
	Markup.escape(value)
end