texta 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/lib/texta.rb +23 -6
- data/texta.gemspec +1 -1
- metadata +1 -1
data/Rakefile
CHANGED
data/lib/texta.rb
CHANGED
@@ -12,8 +12,16 @@ module Texta
|
|
12
12
|
text =~ /<(ul|p|br|li|b|i)\b(.*?)>/
|
13
13
|
end
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
module StringAdapter
|
16
|
+
def texta(mode = :text)
|
17
|
+
Texta.send mode, self
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
module NilAdapter
|
22
|
+
def texta(mode = :text)
|
23
|
+
nil
|
24
|
+
end
|
17
25
|
end
|
18
26
|
|
19
27
|
def self.html(str)
|
@@ -63,12 +71,17 @@ module Texta
|
|
63
71
|
end
|
64
72
|
|
65
73
|
class String
|
66
|
-
include Texta
|
74
|
+
include Texta::StringAdapter
|
75
|
+
end
|
76
|
+
|
77
|
+
class NilClass
|
78
|
+
include Texta::NilAdapter
|
67
79
|
end
|
68
80
|
|
69
81
|
module Texta::Etest
|
70
82
|
def assert_equal_xml(x1, x2)
|
71
|
-
return if x1
|
83
|
+
return if x1 == x2
|
84
|
+
return if x1.to_s.gsub(/\s/, "") == x2.to_s.gsub(/\s/, "")
|
72
85
|
assert_equal(x1 ,x2)
|
73
86
|
end
|
74
87
|
|
@@ -89,10 +102,10 @@ module Texta::Etest
|
|
89
102
|
def test_entities
|
90
103
|
input = "ÄÖÜäöü"
|
91
104
|
html = "html"
|
92
|
-
|
105
|
+
text = "ÄÖÜäöü"
|
93
106
|
html = "<p>ÄÖÜäöü</p>"
|
94
107
|
|
95
|
-
assert_testa input,
|
108
|
+
assert_testa input, text, html
|
96
109
|
end
|
97
110
|
|
98
111
|
def _test_list
|
@@ -173,4 +186,8 @@ HTML
|
|
173
186
|
|
174
187
|
assert_testa input, text, html
|
175
188
|
end
|
189
|
+
|
190
|
+
def test_nil
|
191
|
+
assert_testa nil, nil, nil
|
192
|
+
end
|
176
193
|
end
|
data/texta.gemspec
CHANGED