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.



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

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.



61
62
63
# File 'lib/trenni/markup.rb', line 61

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