Class: Trenni::MarkupString

Inherits:
String
  • Object
show all
Includes:
Markup, Trenni_Markup
Defined in:
lib/trenni/markup.rb,
ext/trenni/escape.c

Overview

Initialized from text which is escaped to use HTML entities.

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Markup

append, escape_string

Constructor Details

#initialize(string = nil, escape = true) ⇒ MarkupString

Returns a new instance of MarkupString.

Parameters:

  • string (String) (defaults to: nil)

    the string value itself.

  • escape (Boolean) (defaults to: true)

    whether or not to escape the string.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/trenni/markup.rb', line 50

def initialize(string = nil, escape = true)
	if string
		if escape
			string = Markup.escape_string(string)
		end
		
		super(string)
	else
		super()
	end
end

Class Method Details

.raw(string) ⇒ Object

Generate a valid MarkupString withot any escaping.



63
64
65
# File 'lib/trenni/markup.rb', line 63

def self.raw(string)
	self.new(string, false)
end