fortitude 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +26 -2
- data/CHANGES.md +29 -0
- data/lib/fortitude.rb +6 -92
- data/lib/fortitude/doctypes.rb +6 -4
- data/lib/fortitude/doctypes/base.rb +6 -2
- data/lib/fortitude/doctypes/html4.rb +2 -1
- data/lib/fortitude/doctypes/html4_frameset.rb +2 -0
- data/lib/fortitude/doctypes/html4_strict.rb +1 -0
- data/lib/fortitude/doctypes/html4_tags_frameset.rb +3 -2
- data/lib/fortitude/doctypes/html4_tags_strict.rb +3 -2
- data/lib/fortitude/doctypes/html4_tags_transitional.rb +3 -2
- data/lib/fortitude/doctypes/html4_transitional.rb +1 -0
- data/lib/fortitude/doctypes/html5.rb +3 -2
- data/lib/fortitude/doctypes/unknown_doctype.rb +1 -0
- data/lib/fortitude/doctypes/xhtml10.rb +2 -1
- data/lib/fortitude/doctypes/xhtml10_frameset.rb +1 -0
- data/lib/fortitude/doctypes/xhtml10_strict.rb +1 -0
- data/lib/fortitude/doctypes/xhtml10_transitional.rb +1 -0
- data/lib/fortitude/doctypes/xhtml11.rb +2 -1
- data/lib/fortitude/{fortitude_ruby_ext.rb → extensions/fortitude_ruby_ext.rb} +16 -11
- data/lib/fortitude/extensions/native_extensions.rb +33 -0
- data/lib/fortitude/{assign_locals_from_template.rb.smpl → method_templates/assign_locals_from_template.rb.smpl} +0 -0
- data/lib/fortitude/{need_assignment_template.rb.smpl → method_templates/need_assignment_template.rb.smpl} +0 -0
- data/lib/fortitude/{need_method_template.rb.smpl → method_templates/need_method_template.rb.smpl} +0 -0
- data/lib/fortitude/method_templates/simple_template.rb +50 -0
- data/lib/fortitude/{tag_method_template.rb.smpl → method_templates/tag_method_template.rb.smpl} +0 -0
- data/lib/fortitude/{text_method_template.rb.smpl → method_templates/text_method_template.rb.smpl} +0 -0
- data/lib/fortitude/rails.rb +26 -0
- data/lib/fortitude/rails/railtie.rb +256 -0
- data/lib/fortitude/rails/widget_methods.rb +0 -4
- data/lib/fortitude/rendering_context.rb +2 -2
- data/lib/fortitude/support/assigns_proxy.rb +77 -0
- data/lib/fortitude/support/class_inheritable_attributes.rb +98 -0
- data/lib/fortitude/support/instance_variable_set.rb +76 -0
- data/lib/fortitude/support/staticized_method.rb +87 -0
- data/lib/fortitude/tags/partial_tag_placeholder.rb +19 -0
- data/lib/fortitude/tags/tag.rb +189 -0
- data/lib/fortitude/tags/tag_return_value.rb +13 -0
- data/lib/fortitude/tags/tag_store.rb +53 -0
- data/lib/fortitude/tags/tag_support.rb +51 -0
- data/lib/fortitude/tags/tags_module.rb +16 -0
- data/lib/fortitude/tilt.rb +17 -0
- data/lib/fortitude/tilt/fortitude_template.rb +13 -13
- data/lib/fortitude/version.rb +1 -1
- data/lib/fortitude/widget.rb +36 -886
- data/lib/fortitude/widget/around_content.rb +53 -0
- data/lib/fortitude/widget/capturing.rb +37 -0
- data/lib/fortitude/widget/content.rb +51 -0
- data/lib/fortitude/widget/doctypes.rb +53 -0
- data/lib/fortitude/widget/helpers.rb +62 -0
- data/lib/fortitude/widget/integration.rb +76 -0
- data/lib/fortitude/widget/localization.rb +63 -0
- data/lib/fortitude/widget/modules_and_subclasses.rb +58 -0
- data/lib/fortitude/widget/needs.rb +164 -0
- data/lib/fortitude/widget/non_rails_widget_methods.rb +13 -0
- data/lib/fortitude/widget/rendering.rb +93 -0
- data/lib/fortitude/widget/start_and_end_comments.rb +69 -0
- data/lib/fortitude/widget/staticization.rb +50 -0
- data/lib/fortitude/widget/tag_like_methods.rb +102 -0
- data/lib/fortitude/widget/tags.rb +55 -0
- data/lib/fortitude/widget/temporary_overrides.rb +28 -0
- data/lib/fortitude/widget/widget_class_inheritable_attributes.rb +35 -0
- data/lib/fortitude/widgets.rb +12 -0
- data/lib/fortitude_jruby_native_ext.jar +0 -0
- data/spec/helpers/system_helpers.rb +3 -3
- data/spec/system/attribute_rules_system_spec.rb +9 -9
- data/spec/system/doctypes_system_spec.rb +15 -0
- data/spec/system/escaping_system_spec.rb +2 -2
- data/spec/system/formatting_system_spec.rb +2 -2
- data/spec/system/id_uniqueness_system_spec.rb +5 -5
- data/spec/system/method_precedence_system_spec.rb +1 -1
- data/spec/system/needs_system_spec.rb +13 -0
- data/spec/system/setting_inheritance_system_spec.rb +20 -20
- data/spec/system/tag_rendering_system_spec.rb +27 -20
- data/spec/system/tag_rules_system_spec.rb +1 -1
- data/spec/system/tag_updating_system_spec.rb +3 -3
- data/spec/system/tilt_system_spec.rb +4 -0
- data/spec/system/void_tags_system_spec.rb +44 -5
- metadata +42 -21
- data/lib/fortitude/assigns_proxy.rb +0 -75
- data/lib/fortitude/class_inheritable_attributes.rb +0 -96
- data/lib/fortitude/instance_variable_set.rb +0 -74
- data/lib/fortitude/non_rails_widget_methods.rb +0 -15
- data/lib/fortitude/partial_tag_placeholder.rb +0 -17
- data/lib/fortitude/railtie.rb +0 -254
- data/lib/fortitude/simple_template.rb +0 -45
- data/lib/fortitude/staticized_method.rb +0 -85
- data/lib/fortitude/tag.rb +0 -162
- data/lib/fortitude/tag_return_value.rb +0 -11
- data/lib/fortitude/tag_store.rb +0 -48
- data/lib/fortitude/tag_support.rb +0 -48
- data/lib/fortitude/tags_module.rb +0 -14
@@ -8,13 +8,21 @@ describe "Fortitude tag rendering", :type => :system do
|
|
8
8
|
end
|
9
9
|
|
10
10
|
it "should render a void tag correctly" do
|
11
|
-
should_render_to("<hr
|
11
|
+
should_render_to("<hr>") { hr }
|
12
12
|
end
|
13
13
|
|
14
14
|
it "should not allow passing text content in a block to a tag that doesn't take content" do
|
15
15
|
expect { r { br { text "hi" } } }.to raise_error(Fortitude::Errors::NoContentAllowed)
|
16
16
|
end
|
17
17
|
|
18
|
+
it "should render a non-self-closing tag correctly" do
|
19
|
+
should_render_to("<script></script>") { script }
|
20
|
+
should_render_to("<script></script>") { script { } }
|
21
|
+
should_render_to("<script></script>") { script('') }
|
22
|
+
should_render_to("<script></script>") { script('') { } }
|
23
|
+
should_render_to("<script src=\"foo\"></script>") { script(:src => "foo") }
|
24
|
+
end
|
25
|
+
|
18
26
|
it "should quote HTML specs at you when you screw up" do
|
19
27
|
expect { r { br { text "hi" } } }.to raise_error(Fortitude::Errors::NoContentAllowed, /THE_SPEC_FOR_BR/)
|
20
28
|
end
|
@@ -104,36 +112,36 @@ describe "Fortitude tag rendering", :type => :system do
|
|
104
112
|
end
|
105
113
|
|
106
114
|
it "should render a tag with an attribute correctly" do
|
107
|
-
should_render_to("<hr class=\"foo\"
|
115
|
+
should_render_to("<hr class=\"foo\">") { hr 'class' => 'foo' }
|
108
116
|
end
|
109
117
|
|
110
118
|
it "should convert symbol attribute names to strings" do
|
111
|
-
should_render_to("<hr class=\"foo\"
|
119
|
+
should_render_to("<hr class=\"foo\">") { hr :class => 'foo' }
|
112
120
|
end
|
113
121
|
|
114
122
|
it "should convert symbol attribute values to strings" do
|
115
|
-
should_render_to("<hr class=\"foo\"
|
123
|
+
should_render_to("<hr class=\"foo\">") { hr 'class' => :foo }
|
116
124
|
end
|
117
125
|
|
118
126
|
it "should allow numbers for attribute names" do
|
119
|
-
should_render_to("<hr 12345=\"foo\"
|
127
|
+
should_render_to("<hr 12345=\"foo\">") { hr 12345 => 'foo' }
|
120
128
|
end
|
121
129
|
|
122
130
|
it "should allow numbers for attribute values, and still quote them" do
|
123
|
-
should_render_to("<hr class=\"12345\"
|
131
|
+
should_render_to("<hr class=\"12345\">") { hr 'class' => 12345 }
|
124
132
|
end
|
125
133
|
|
126
134
|
it "should escape attribute names" do
|
127
|
-
should_render_to("<hr <&">=\"foo\"
|
135
|
+
should_render_to("<hr <&">=\"foo\">") { hr '<&">' => "foo" }
|
128
136
|
end
|
129
137
|
|
130
138
|
it "should escape attribute values" do
|
131
|
-
should_render_to("<hr class=\"<&">\"
|
139
|
+
should_render_to("<hr class=\"<&">\">") { hr :class => "<&\">" }
|
132
140
|
end
|
133
141
|
|
134
142
|
it "should separate multiple attributes with spaces" do
|
135
143
|
result = r { hr 'class' => "foo", 'other' => "bar" }
|
136
|
-
expect(result).to match(%r{^<hr .*\"
|
144
|
+
expect(result).to match(%r{^<hr .*\">$})
|
137
145
|
expect(result).to match(%r{ class=\"foo\"})
|
138
146
|
expect(result).to match(%r{ other=\"bar\"})
|
139
147
|
end
|
@@ -152,7 +160,7 @@ describe "Fortitude tag rendering", :type => :system do
|
|
152
160
|
order.each_with_index do |attrname, index|
|
153
161
|
expected_string << " #{attrname}=\"order#{index}\""
|
154
162
|
end
|
155
|
-
expected_string << "
|
163
|
+
expected_string << ">"
|
156
164
|
|
157
165
|
should_render_to(expected_string) { hr attributes }
|
158
166
|
end
|
@@ -200,54 +208,53 @@ describe "Fortitude tag rendering", :type => :system do
|
|
200
208
|
|
201
209
|
it "should render attribute values that are hashes as a sequence of prefixed attributes" do
|
202
210
|
result = r { p :data => { :foo => 'bar', :bar => 'baz' } }
|
203
|
-
expect(result).to match(%r{^<p .*\"
|
211
|
+
expect(result).to match(%r{^<p .*\"></p>$})
|
204
212
|
expect(result).to match(%r{ data-foo=\"bar\"})
|
205
213
|
expect(result).to match(%r{ data-bar=\"baz\"})
|
206
214
|
end
|
207
215
|
|
208
216
|
it "should render an arbitrary object as an attribute key, escaping it" do
|
209
217
|
foo = arbitrary_object_with_to_s("and&<>\"this")
|
210
|
-
should_render_to("<p and&<>"this=\"bar\"
|
218
|
+
should_render_to("<p and&<>"this=\"bar\"></p>") { p foo => "bar" }
|
211
219
|
end
|
212
220
|
|
213
221
|
it "should render an arbitrary object as an attribute value, escaping it" do
|
214
222
|
foo = arbitrary_object_with_to_s("and&<>\"this")
|
215
|
-
should_render_to("<p foo=\"and&<>"this\"
|
223
|
+
should_render_to("<p foo=\"and&<>"this\"></p>") { p :foo => foo }
|
216
224
|
end
|
217
225
|
|
218
226
|
it "should render an arbitrary object as an attribute key nested in a hash, escaping it" do
|
219
227
|
foo = arbitrary_object_with_to_s("and&<>\"this")
|
220
|
-
should_render_to("<p data-and&<>"this=\"bar\"
|
228
|
+
should_render_to("<p data-and&<>"this=\"bar\"></p>") { p :data => { foo => "bar" } }
|
221
229
|
end
|
222
230
|
|
223
231
|
it "should render an arbitrary object as an attribute value nested in a hash, escaping it" do
|
224
232
|
foo = arbitrary_object_with_to_s("and&<>\"this")
|
225
|
-
should_render_to("<p data-and&<>"this=\"bar\"
|
233
|
+
should_render_to("<p data-and&<>"this=\"bar\"></p>") { p :data => { foo => "bar" } }
|
226
234
|
end
|
227
235
|
|
228
236
|
it "should allow an arbitrary object as an attribute key, mapping to a hash" do
|
229
237
|
foo = arbitrary_object_with_to_s("and&<>\"this")
|
230
238
|
result = r { p foo => { :foo => 'bar', :bar => 'baz' } }
|
231
|
-
expect(result).to match(%r{^<p .*\"
|
239
|
+
expect(result).to match(%r{^<p .*\"></p>$})
|
232
240
|
expect(result).to match(%r{ and&<>"this-foo=\"bar\"})
|
233
241
|
expect(result).to match(%r{ and&<>"this-bar=\"baz\"})
|
234
|
-
# should_render_to("<p and&<>"this-foo=\"bar\" and&<>"this-bar=\"baz\"/>")
|
235
242
|
end
|
236
243
|
|
237
244
|
it "should allow multi-level hash nesting" do
|
238
245
|
result = r { p :foo => { :bar => 'bar', :baz => { :a => 'xxx', 'b' => :yyy } } }
|
239
|
-
expect(result).to match(%r{^<p .*\"
|
246
|
+
expect(result).to match(%r{^<p .*\"></p>})
|
240
247
|
expect(result).to match(%r{ foo-bar=\"bar\"})
|
241
248
|
expect(result).to match(%r{ foo-baz-a=\"xxx\"})
|
242
249
|
expect(result).to match(%r{ foo-baz-b=\"yyy\"})
|
243
250
|
end
|
244
251
|
|
245
252
|
it "should allow arrays as attribute values, separating elements with spaces" do
|
246
|
-
should_render_to("<p foo=\"bar baz quux\"
|
253
|
+
should_render_to("<p foo=\"bar baz quux\"></p>") { p :foo => [ 'bar', 'baz', 'quux' ]}
|
247
254
|
end
|
248
255
|
|
249
256
|
it "should allow arrays as attribute values, calling #to_s on values in them" do
|
250
257
|
quux = arbitrary_object_with_to_s("quux")
|
251
|
-
should_render_to("<p foo=\"bar baz quux\"
|
258
|
+
should_render_to("<p foo=\"bar baz quux\"></p>") { p :foo => [ 'bar', :baz, quux ]}
|
252
259
|
end
|
253
260
|
end
|
@@ -14,7 +14,7 @@ describe "Fortitude tag rules enforcement", :type => :system do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "should allow a <b> inside a <p>" do
|
17
|
-
expect(render(widget_class_with_content { p { b } })).to eq('<p><b
|
17
|
+
expect(render(widget_class_with_content { p { b } })).to eq('<p><b></b></p>')
|
18
18
|
end
|
19
19
|
|
20
20
|
it "should not allow text where it's, well, not allowed, when specified directly" do
|
@@ -62,7 +62,7 @@ describe "Fortitude tag updating", :type => :system do
|
|
62
62
|
end
|
63
63
|
end
|
64
64
|
|
65
|
-
expect(render(@derived_class)).to eq("<foo quux=\"baz\"
|
65
|
+
expect(render(@derived_class)).to eq("<foo quux=\"baz\"></foo>")
|
66
66
|
|
67
67
|
@base_class.class_eval do
|
68
68
|
def content
|
@@ -81,7 +81,7 @@ describe "Fortitude tag updating", :type => :system do
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
expect(render(@derived_class)).to eq("<foo quux=\"baz\"
|
84
|
+
expect(render(@derived_class)).to eq("<foo quux=\"baz\"></foo>")
|
85
85
|
end
|
86
86
|
|
87
87
|
it "should allow modifying a tag's :can_enclose" do
|
@@ -156,7 +156,7 @@ describe "Fortitude tag updating", :type => :system do
|
|
156
156
|
end
|
157
157
|
end
|
158
158
|
|
159
|
-
expect(render(@base_class)).to eq("<p bonk=\"whatever\"
|
159
|
+
expect(render(@base_class)).to eq("<p bonk=\"whatever\"></p>")
|
160
160
|
|
161
161
|
other_widget = widget_class do
|
162
162
|
enforce_attribute_rules true
|
@@ -42,6 +42,10 @@ EOS
|
|
42
42
|
expect(render_text_with_tilt("simple_template.rb", text)).to eq("this is<p>a simple widget</p>!")
|
43
43
|
end
|
44
44
|
|
45
|
+
it "should allow the Tilt template to be created with an empty string, since earlier versions of Tilt do that" do
|
46
|
+
expect { Fortitude::Tilt::FortitudeTemplate.new { "" } }.not_to raise_error
|
47
|
+
end
|
48
|
+
|
45
49
|
SIMPLE_TEMPLATE_WITH_VARIABLES = <<-EOS
|
46
50
|
class SimpleTemplateWithVariables < Fortitude::Widgets::Html5
|
47
51
|
needs :foo, :bar => 'whatever'
|
@@ -5,34 +5,36 @@ describe "Fortitude void tags", :type => :system do
|
|
5
5
|
|
6
6
|
def content
|
7
7
|
thevoid
|
8
|
+
thevoid(:foo => 'bar')
|
8
9
|
end
|
9
10
|
end
|
10
11
|
end
|
11
12
|
|
12
|
-
it "should close void tags by default" do
|
13
|
+
it "should not close void tags by default" do
|
13
14
|
vtc = widget_class(:superclass => Fortitude::Widget) do
|
14
15
|
tag :thevoid, :content_allowed => false
|
15
16
|
|
16
17
|
def content
|
17
18
|
thevoid
|
19
|
+
thevoid(:foo => 'bar')
|
18
20
|
end
|
19
21
|
end
|
20
22
|
|
21
|
-
expect(render(vtc)).to eq("<thevoid
|
23
|
+
expect(render(vtc)).to eq("<thevoid><thevoid foo=\"bar\">")
|
22
24
|
end
|
23
25
|
|
24
26
|
it "should not close void tags if asked not to" do
|
25
27
|
klass = void_tag_class
|
26
28
|
klass.close_void_tags false
|
27
29
|
|
28
|
-
expect(render(klass)).to eq("<thevoid>")
|
30
|
+
expect(render(klass)).to eq("<thevoid><thevoid foo=\"bar\">")
|
29
31
|
end
|
30
32
|
|
31
33
|
it "should close void tags if asked to" do
|
32
34
|
klass = void_tag_class
|
33
35
|
klass.close_void_tags true
|
34
36
|
|
35
|
-
expect(render(klass)).to eq("<thevoid/>")
|
37
|
+
expect(render(klass)).to eq("<thevoid/><thevoid foo=\"bar\"/>")
|
36
38
|
end
|
37
39
|
|
38
40
|
it "should not affect non-void tags with no content" do
|
@@ -40,12 +42,49 @@ describe "Fortitude void tags", :type => :system do
|
|
40
42
|
klass.class_eval do
|
41
43
|
def content
|
42
44
|
p
|
45
|
+
p(:foo => "bar")
|
43
46
|
div ""
|
47
|
+
div(:foo => "bar")
|
44
48
|
span { }
|
49
|
+
span(:foo => "bar")
|
45
50
|
end
|
46
51
|
end
|
47
52
|
klass.close_void_tags false
|
48
53
|
|
49
|
-
expect(render(klass)).to eq("<p
|
54
|
+
expect(render(klass)).to eq("<p></p><p foo=\"bar\"></p><div></div><div foo=\"bar\"></div><span></span><span foo=\"bar\"></span>")
|
55
|
+
end
|
56
|
+
|
57
|
+
it "should not affect non-void tags with no content, and close_void_tags set to true" do
|
58
|
+
klass = void_tag_class
|
59
|
+
klass.class_eval do
|
60
|
+
def content
|
61
|
+
p
|
62
|
+
p(:foo => "bar")
|
63
|
+
div ""
|
64
|
+
div(:foo => "bar")
|
65
|
+
span { }
|
66
|
+
span(:foo => "bar")
|
67
|
+
end
|
68
|
+
end
|
69
|
+
klass.close_void_tags true
|
70
|
+
|
71
|
+
expect(render(klass)).to eq("<p></p><p foo=\"bar\"></p><div></div><div foo=\"bar\"></div><span></span><span foo=\"bar\"></span>")
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should not affect non-void tags with no content, and close_void_tags set to false" do
|
75
|
+
klass = void_tag_class
|
76
|
+
klass.class_eval do
|
77
|
+
def content
|
78
|
+
p
|
79
|
+
p(:foo => "bar")
|
80
|
+
div ""
|
81
|
+
div(:foo => "bar")
|
82
|
+
span { }
|
83
|
+
span(:foo => "bar")
|
84
|
+
end
|
85
|
+
end
|
86
|
+
klass.close_void_tags false
|
87
|
+
|
88
|
+
expect(render(klass)).to eq("<p></p><p foo=\"bar\"></p><div></div><div foo=\"bar\"></div><span></span><span foo=\"bar\"></span>")
|
50
89
|
end
|
51
90
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fortitude
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Geweke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-06-
|
11
|
+
date: 2014-06-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -120,6 +120,7 @@ files:
|
|
120
120
|
- ".gitignore"
|
121
121
|
- ".rspec-local"
|
122
122
|
- ".travis.yml"
|
123
|
+
- CHANGES.md
|
123
124
|
- Gemfile
|
124
125
|
- LICENSE.txt
|
125
126
|
- README-erector.md
|
@@ -131,9 +132,6 @@ files:
|
|
131
132
|
- ext/fortitude_native_ext/fortitude_native_ext.c
|
132
133
|
- fortitude.gemspec
|
133
134
|
- lib/fortitude.rb
|
134
|
-
- lib/fortitude/assign_locals_from_template.rb.smpl
|
135
|
-
- lib/fortitude/assigns_proxy.rb
|
136
|
-
- lib/fortitude/class_inheritable_attributes.rb
|
137
135
|
- lib/fortitude/doctypes.rb
|
138
136
|
- lib/fortitude/doctypes/base.rb
|
139
137
|
- lib/fortitude/doctypes/html4.rb
|
@@ -151,31 +149,54 @@ files:
|
|
151
149
|
- lib/fortitude/doctypes/xhtml10_transitional.rb
|
152
150
|
- lib/fortitude/doctypes/xhtml11.rb
|
153
151
|
- lib/fortitude/errors.rb
|
154
|
-
- lib/fortitude/fortitude_ruby_ext.rb
|
155
|
-
- lib/fortitude/
|
156
|
-
- lib/fortitude/
|
157
|
-
- lib/fortitude/
|
158
|
-
- lib/fortitude/
|
159
|
-
- lib/fortitude/
|
152
|
+
- lib/fortitude/extensions/fortitude_ruby_ext.rb
|
153
|
+
- lib/fortitude/extensions/native_extensions.rb
|
154
|
+
- lib/fortitude/method_templates/assign_locals_from_template.rb.smpl
|
155
|
+
- lib/fortitude/method_templates/need_assignment_template.rb.smpl
|
156
|
+
- lib/fortitude/method_templates/need_method_template.rb.smpl
|
157
|
+
- lib/fortitude/method_templates/simple_template.rb
|
158
|
+
- lib/fortitude/method_templates/tag_method_template.rb.smpl
|
159
|
+
- lib/fortitude/method_templates/text_method_template.rb.smpl
|
160
|
+
- lib/fortitude/rails.rb
|
160
161
|
- lib/fortitude/rails/helpers.rb
|
162
|
+
- lib/fortitude/rails/railtie.rb
|
161
163
|
- lib/fortitude/rails/renderer.rb
|
162
164
|
- lib/fortitude/rails/template_handler.rb
|
163
165
|
- lib/fortitude/rails/widget_methods.rb
|
164
166
|
- lib/fortitude/rails/yielded_object_outputter.rb
|
165
|
-
- lib/fortitude/railtie.rb
|
166
167
|
- lib/fortitude/rendering_context.rb
|
167
|
-
- lib/fortitude/
|
168
|
-
- lib/fortitude/
|
169
|
-
- lib/fortitude/
|
170
|
-
- lib/fortitude/
|
171
|
-
- lib/fortitude/
|
172
|
-
- lib/fortitude/
|
173
|
-
- lib/fortitude/
|
174
|
-
- lib/fortitude/
|
175
|
-
- lib/fortitude/
|
168
|
+
- lib/fortitude/support/assigns_proxy.rb
|
169
|
+
- lib/fortitude/support/class_inheritable_attributes.rb
|
170
|
+
- lib/fortitude/support/instance_variable_set.rb
|
171
|
+
- lib/fortitude/support/staticized_method.rb
|
172
|
+
- lib/fortitude/tags/partial_tag_placeholder.rb
|
173
|
+
- lib/fortitude/tags/tag.rb
|
174
|
+
- lib/fortitude/tags/tag_return_value.rb
|
175
|
+
- lib/fortitude/tags/tag_store.rb
|
176
|
+
- lib/fortitude/tags/tag_support.rb
|
177
|
+
- lib/fortitude/tags/tags_module.rb
|
178
|
+
- lib/fortitude/tilt.rb
|
176
179
|
- lib/fortitude/tilt/fortitude_template.rb
|
177
180
|
- lib/fortitude/version.rb
|
178
181
|
- lib/fortitude/widget.rb
|
182
|
+
- lib/fortitude/widget/around_content.rb
|
183
|
+
- lib/fortitude/widget/capturing.rb
|
184
|
+
- lib/fortitude/widget/content.rb
|
185
|
+
- lib/fortitude/widget/doctypes.rb
|
186
|
+
- lib/fortitude/widget/helpers.rb
|
187
|
+
- lib/fortitude/widget/integration.rb
|
188
|
+
- lib/fortitude/widget/localization.rb
|
189
|
+
- lib/fortitude/widget/modules_and_subclasses.rb
|
190
|
+
- lib/fortitude/widget/needs.rb
|
191
|
+
- lib/fortitude/widget/non_rails_widget_methods.rb
|
192
|
+
- lib/fortitude/widget/rendering.rb
|
193
|
+
- lib/fortitude/widget/start_and_end_comments.rb
|
194
|
+
- lib/fortitude/widget/staticization.rb
|
195
|
+
- lib/fortitude/widget/tag_like_methods.rb
|
196
|
+
- lib/fortitude/widget/tags.rb
|
197
|
+
- lib/fortitude/widget/temporary_overrides.rb
|
198
|
+
- lib/fortitude/widget/widget_class_inheritable_attributes.rb
|
199
|
+
- lib/fortitude/widgets.rb
|
179
200
|
- lib/fortitude/widgets/html4_frameset.rb
|
180
201
|
- lib/fortitude/widgets/html4_strict.rb
|
181
202
|
- lib/fortitude/widgets/html4_transitional.rb
|
@@ -1,75 +0,0 @@
|
|
1
|
-
require 'active_support/core_ext'
|
2
|
-
|
3
|
-
module Fortitude
|
4
|
-
class AssignsProxy
|
5
|
-
def initialize(widget, keys)
|
6
|
-
@widget = widget
|
7
|
-
@keys = { }
|
8
|
-
keys.each { |k| @keys[k] = true }
|
9
|
-
end
|
10
|
-
|
11
|
-
def is_default?(x)
|
12
|
-
!! @widget._fortitude_default_assigns[x.to_sym]
|
13
|
-
end
|
14
|
-
|
15
|
-
def keys
|
16
|
-
@keys.keys
|
17
|
-
end
|
18
|
-
|
19
|
-
def has_key?(x)
|
20
|
-
!! @keys[x.to_sym]
|
21
|
-
end
|
22
|
-
|
23
|
-
def [](x)
|
24
|
-
if has_key?(x)
|
25
|
-
ivar_name = @widget.class.instance_variable_name_for_need(x)
|
26
|
-
@widget.instance_variable_get(ivar_name)
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def []=(x, y)
|
31
|
-
if has_key?(x)
|
32
|
-
ivar_name = @widget.class.instance_variable_name_for_need(x)
|
33
|
-
@widget.instance_variable_set(ivar_name, y)
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
def to_hash
|
38
|
-
out = { }
|
39
|
-
keys.each { |k| out[k] = self[k] }
|
40
|
-
out
|
41
|
-
end
|
42
|
-
|
43
|
-
def to_h
|
44
|
-
to_hash
|
45
|
-
end
|
46
|
-
|
47
|
-
def length
|
48
|
-
@keys.length
|
49
|
-
end
|
50
|
-
|
51
|
-
def size
|
52
|
-
@keys.size
|
53
|
-
end
|
54
|
-
|
55
|
-
def to_s
|
56
|
-
"<Assigns for #{@widget}: #{to_hash}>"
|
57
|
-
end
|
58
|
-
|
59
|
-
def inspect
|
60
|
-
"<Assigns for #{@widget}: #{to_hash.inspect}>"
|
61
|
-
end
|
62
|
-
|
63
|
-
def member?(x)
|
64
|
-
has_key?(x)
|
65
|
-
end
|
66
|
-
|
67
|
-
def store(key, value)
|
68
|
-
self[key] = value
|
69
|
-
end
|
70
|
-
|
71
|
-
delegate :==, :assoc, :each, :each_pair, :each_key, :each_value, :empty?, :eql?, :fetch, :flatten,
|
72
|
-
:has_value?, :hash, :include?, :invert, :key, :key?, :merge, :rassoc, :reject, :select,
|
73
|
-
:to_a, :value?, :values, :values_at, :to => :to_hash
|
74
|
-
end
|
75
|
-
end
|