fortitude 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +26 -2
  3. data/CHANGES.md +29 -0
  4. data/lib/fortitude.rb +6 -92
  5. data/lib/fortitude/doctypes.rb +6 -4
  6. data/lib/fortitude/doctypes/base.rb +6 -2
  7. data/lib/fortitude/doctypes/html4.rb +2 -1
  8. data/lib/fortitude/doctypes/html4_frameset.rb +2 -0
  9. data/lib/fortitude/doctypes/html4_strict.rb +1 -0
  10. data/lib/fortitude/doctypes/html4_tags_frameset.rb +3 -2
  11. data/lib/fortitude/doctypes/html4_tags_strict.rb +3 -2
  12. data/lib/fortitude/doctypes/html4_tags_transitional.rb +3 -2
  13. data/lib/fortitude/doctypes/html4_transitional.rb +1 -0
  14. data/lib/fortitude/doctypes/html5.rb +3 -2
  15. data/lib/fortitude/doctypes/unknown_doctype.rb +1 -0
  16. data/lib/fortitude/doctypes/xhtml10.rb +2 -1
  17. data/lib/fortitude/doctypes/xhtml10_frameset.rb +1 -0
  18. data/lib/fortitude/doctypes/xhtml10_strict.rb +1 -0
  19. data/lib/fortitude/doctypes/xhtml10_transitional.rb +1 -0
  20. data/lib/fortitude/doctypes/xhtml11.rb +2 -1
  21. data/lib/fortitude/{fortitude_ruby_ext.rb → extensions/fortitude_ruby_ext.rb} +16 -11
  22. data/lib/fortitude/extensions/native_extensions.rb +33 -0
  23. data/lib/fortitude/{assign_locals_from_template.rb.smpl → method_templates/assign_locals_from_template.rb.smpl} +0 -0
  24. data/lib/fortitude/{need_assignment_template.rb.smpl → method_templates/need_assignment_template.rb.smpl} +0 -0
  25. data/lib/fortitude/{need_method_template.rb.smpl → method_templates/need_method_template.rb.smpl} +0 -0
  26. data/lib/fortitude/method_templates/simple_template.rb +50 -0
  27. data/lib/fortitude/{tag_method_template.rb.smpl → method_templates/tag_method_template.rb.smpl} +0 -0
  28. data/lib/fortitude/{text_method_template.rb.smpl → method_templates/text_method_template.rb.smpl} +0 -0
  29. data/lib/fortitude/rails.rb +26 -0
  30. data/lib/fortitude/rails/railtie.rb +256 -0
  31. data/lib/fortitude/rails/widget_methods.rb +0 -4
  32. data/lib/fortitude/rendering_context.rb +2 -2
  33. data/lib/fortitude/support/assigns_proxy.rb +77 -0
  34. data/lib/fortitude/support/class_inheritable_attributes.rb +98 -0
  35. data/lib/fortitude/support/instance_variable_set.rb +76 -0
  36. data/lib/fortitude/support/staticized_method.rb +87 -0
  37. data/lib/fortitude/tags/partial_tag_placeholder.rb +19 -0
  38. data/lib/fortitude/tags/tag.rb +189 -0
  39. data/lib/fortitude/tags/tag_return_value.rb +13 -0
  40. data/lib/fortitude/tags/tag_store.rb +53 -0
  41. data/lib/fortitude/tags/tag_support.rb +51 -0
  42. data/lib/fortitude/tags/tags_module.rb +16 -0
  43. data/lib/fortitude/tilt.rb +17 -0
  44. data/lib/fortitude/tilt/fortitude_template.rb +13 -13
  45. data/lib/fortitude/version.rb +1 -1
  46. data/lib/fortitude/widget.rb +36 -886
  47. data/lib/fortitude/widget/around_content.rb +53 -0
  48. data/lib/fortitude/widget/capturing.rb +37 -0
  49. data/lib/fortitude/widget/content.rb +51 -0
  50. data/lib/fortitude/widget/doctypes.rb +53 -0
  51. data/lib/fortitude/widget/helpers.rb +62 -0
  52. data/lib/fortitude/widget/integration.rb +76 -0
  53. data/lib/fortitude/widget/localization.rb +63 -0
  54. data/lib/fortitude/widget/modules_and_subclasses.rb +58 -0
  55. data/lib/fortitude/widget/needs.rb +164 -0
  56. data/lib/fortitude/widget/non_rails_widget_methods.rb +13 -0
  57. data/lib/fortitude/widget/rendering.rb +93 -0
  58. data/lib/fortitude/widget/start_and_end_comments.rb +69 -0
  59. data/lib/fortitude/widget/staticization.rb +50 -0
  60. data/lib/fortitude/widget/tag_like_methods.rb +102 -0
  61. data/lib/fortitude/widget/tags.rb +55 -0
  62. data/lib/fortitude/widget/temporary_overrides.rb +28 -0
  63. data/lib/fortitude/widget/widget_class_inheritable_attributes.rb +35 -0
  64. data/lib/fortitude/widgets.rb +12 -0
  65. data/lib/fortitude_jruby_native_ext.jar +0 -0
  66. data/spec/helpers/system_helpers.rb +3 -3
  67. data/spec/system/attribute_rules_system_spec.rb +9 -9
  68. data/spec/system/doctypes_system_spec.rb +15 -0
  69. data/spec/system/escaping_system_spec.rb +2 -2
  70. data/spec/system/formatting_system_spec.rb +2 -2
  71. data/spec/system/id_uniqueness_system_spec.rb +5 -5
  72. data/spec/system/method_precedence_system_spec.rb +1 -1
  73. data/spec/system/needs_system_spec.rb +13 -0
  74. data/spec/system/setting_inheritance_system_spec.rb +20 -20
  75. data/spec/system/tag_rendering_system_spec.rb +27 -20
  76. data/spec/system/tag_rules_system_spec.rb +1 -1
  77. data/spec/system/tag_updating_system_spec.rb +3 -3
  78. data/spec/system/tilt_system_spec.rb +4 -0
  79. data/spec/system/void_tags_system_spec.rb +44 -5
  80. metadata +42 -21
  81. data/lib/fortitude/assigns_proxy.rb +0 -75
  82. data/lib/fortitude/class_inheritable_attributes.rb +0 -96
  83. data/lib/fortitude/instance_variable_set.rb +0 -74
  84. data/lib/fortitude/non_rails_widget_methods.rb +0 -15
  85. data/lib/fortitude/partial_tag_placeholder.rb +0 -17
  86. data/lib/fortitude/railtie.rb +0 -254
  87. data/lib/fortitude/simple_template.rb +0 -45
  88. data/lib/fortitude/staticized_method.rb +0 -85
  89. data/lib/fortitude/tag.rb +0 -162
  90. data/lib/fortitude/tag_return_value.rb +0 -11
  91. data/lib/fortitude/tag_store.rb +0 -48
  92. data/lib/fortitude/tag_support.rb +0 -48
  93. data/lib/fortitude/tags_module.rb +0 -14
@@ -1,96 +0,0 @@
1
- require 'active_support'
2
- require 'active_support/concern'
3
-
4
- module Fortitude
5
- module ClassInheritableAttributes
6
- extend ActiveSupport::Concern
7
-
8
- module ClassMethods
9
- def _fortitude_invoke_class_inheritable_attribute(attribute_name, allowable_values, *args)
10
- raise ArgumentError, "Invalid arguments: #{args.inspect}" if args.length > 1
11
- instance_variable_name = "@_fortitude_#{attribute_name}"
12
- if args.length == 0
13
- _fortitude_read_class_inheritable_attribute(attribute_name, instance_variable_name, false)
14
- else
15
- _fortitude_write_class_inheritable_attribute(attribute_name, instance_variable_name, allowable_values, args[0])
16
- end
17
- end
18
-
19
- def _fortitude_read_class_inheritable_attribute(attribute_name, instance_variable_name, allow_not_present)
20
- return instance_variable_get(instance_variable_name) if instance_variable_defined?(instance_variable_name)
21
- return superclass.send(attribute_name) if superclass.respond_to?(attribute_name)
22
-
23
- if allow_not_present
24
- :_fortitude_class_inheritable_attribute_not_present
25
- else
26
- raise "Fortitude class-inheritable attribute error: there should always be a declared value for #{attribute_name} at the top of the inheritance hierarchy somewhere"
27
- end
28
- end
29
-
30
- def _fortitude_write_class_inheritable_attribute(attribute_name, instance_variable_name, allowable_values, new_value)
31
- allowed = if allowable_values.respond_to?(:call)
32
- allowable_values.call(new_value)
33
- else
34
- allowable_values.include?(new_value)
35
- end
36
-
37
- if (! allowed)
38
- error = "#{attribute_name} cannot be set to #{new_value.inspect}"
39
- error << "; valid values are: #{allowable_values.inspect}" unless allowable_values.respond_to?(:call)
40
- raise ArgumentError, error
41
- end
42
-
43
- old_value = _fortitude_read_class_inheritable_attribute(attribute_name, instance_variable_name, true)
44
-
45
- instance_variable_set(instance_variable_name, new_value)
46
-
47
- if (old_value != :_fortitude_class_inheritable_attribute_not_present) && (new_value != old_value)
48
- _fortitude_class_inheritable_attribute_changed!(attribute_name, old_value, new_value)
49
- end
50
-
51
- new_value
52
- end
53
-
54
- def _fortitude_class_inheritable_attribute(attribute_name, default_value, allowable_values)
55
- metaclass = (class << self; self; end)
56
-
57
- metaclass.send(:define_method, attribute_name) do |*args|
58
- _fortitude_invoke_class_inheritable_attribute(attribute_name, allowable_values, *args)
59
- end
60
-
61
- send(attribute_name, default_value)
62
- end
63
-
64
- def _fortitude_on_class_inheritable_attribute_change(*attribute_names, &block)
65
- if attribute_names.length == 0
66
- raise ArgumentError, "You must pass at least one attribute name, not: #{attribute_names.inspect}"
67
- end
68
-
69
- @_fortitude_class_inheritable_attribute_change_callbacks ||= { }
70
- attribute_names.each do |attribute_name|
71
- @_fortitude_class_inheritable_attribute_change_callbacks[attribute_name] ||= [ ]
72
- @_fortitude_class_inheritable_attribute_change_callbacks[attribute_name] |= [ block ]
73
- end
74
- end
75
-
76
- def _fortitude_class_inheritable_attribute_callbacks_for(attribute_name)
77
- out = if superclass.respond_to?(:_fortitude_class_inheritable_attribute_callbacks_for)
78
- superclass._fortitude_class_inheritable_attribute_callbacks_for(attribute_name)
79
- else
80
- [ ]
81
- end
82
-
83
- @_fortitude_class_inheritable_attribute_change_callbacks ||= { }
84
- out += @_fortitude_class_inheritable_attribute_change_callbacks[attribute_name] || [ ]
85
-
86
- out
87
- end
88
-
89
- def _fortitude_class_inheritable_attribute_changed!(attribute_name, old_value, new_value)
90
- callbacks = _fortitude_class_inheritable_attribute_callbacks_for(attribute_name)
91
- # klass = self
92
- callbacks.each { |cb| instance_exec(attribute_name, old_value, new_value, &cb) }
93
- end
94
- end
95
- end
96
- end
@@ -1,74 +0,0 @@
1
- module Fortitude
2
- class InstanceVariableSet
3
- def initialize(target_object)
4
- @target_object = target_object
5
- end
6
-
7
- def [](name)
8
- target_object.instance_variable_get("@#{name}")
9
- end
10
-
11
- def []=(name, value)
12
- target_object.instance_variable_set("@#{name}", value)
13
- end
14
-
15
- def keys
16
- target_object.instance_variables.map do |instance_variable_name|
17
- $1.to_sym if instance_variable_name.to_s =~ /^@(.*)$/
18
- end.compact
19
- end
20
-
21
- def each
22
- keys.each { |k| yield k, self[k] }
23
- end
24
-
25
- def with_instance_variable_copying(widget)
26
- before_copy = widget.instance_variables
27
- skip_copy = before_copy - target_object.instance_variables
28
-
29
- copy_to_widget(widget)
30
- begin
31
- yield
32
- ensure
33
- copy_from_widget(widget, skip_copy)
34
- end
35
- end
36
-
37
- private
38
- def copy_to_widget(widget)
39
- needs = widget.needs_as_hash
40
- extras = widget.widget_extra_assigns
41
-
42
- target_object.instance_variables.each do |instance_variable_name|
43
- if instance_variable_name =~ /^@(.*)$/
44
- without_at = $1.to_sym
45
- next if needs.has_key?(without_at)
46
- next if extras.has_key?(without_at)
47
-
48
- value = target_object.instance_variable_get(instance_variable_name)
49
- widget.instance_variable_set(instance_variable_name, value)
50
- end
51
- end
52
- end
53
-
54
- def copy_from_widget(widget, exclude_variables = [ ])
55
- needs = widget.needs_as_hash
56
- extras = widget.widget_extra_assigns
57
-
58
- (widget.instance_variables - exclude_variables).each do |instance_variable_name|
59
- next if instance_variable_name =~ /^@_fortitude_/
60
-
61
- if instance_variable_name =~ /^@(.*)$/i
62
- without_at = $1.to_sym
63
- next if needs.has_key?(without_at)
64
- next if extras.has_key?(without_at)
65
-
66
- value = widget.instance_variable_get(instance_variable_name)
67
- target_object.instance_variable_set(instance_variable_name, value)
68
- end
69
- end
70
- end
71
-
72
- attr_reader :target_object
73
- end
74
- end
@@ -1,15 +0,0 @@
1
- require 'active_support'
2
-
3
- module Fortitude
4
- module NonRailsWidgetMethods
5
- extend ActiveSupport::Concern
6
-
7
- def widget_locale
8
- nil
9
- end
10
-
11
- module ClassMethods
12
-
13
- end
14
- end
15
- end
@@ -1,17 +0,0 @@
1
- module Fortitude
2
- class PartialTagPlaceholder
3
- class << self
4
- def instance
5
- @instance ||= new
6
- end
7
- end
8
-
9
- def name
10
- :_fortitude_partial_placeholder
11
- end
12
-
13
- def validate_can_enclose!(widget, tag_object)
14
- # nothing here, always OK
15
- end
16
- end
17
- end
@@ -1,254 +0,0 @@
1
- require 'fortitude/rendering_context'
2
-
3
- if defined?(ActiveSupport)
4
- ActiveSupport.on_load(:before_initialize) do
5
- ActiveSupport.on_load(:action_view) do
6
- require "fortitude/rails/template_handler"
7
- end
8
- end
9
- end
10
-
11
- module Fortitude
12
- class << self
13
- def refine_rails_helpers(on_or_off = :not_specified)
14
- @refine_rails_helpers = !! on_or_off unless on_or_off == :not_specified
15
- !! @refine_rails_helpers
16
- end
17
- end
18
-
19
- refine_rails_helpers true
20
- end
21
-
22
- module Fortitude
23
- class Railtie < ::Rails::Railtie
24
- config.after_initialize do
25
- if Fortitude.refine_rails_helpers
26
- require 'fortitude/rails/helpers'
27
- Fortitude::Rails::Helpers.apply_refined_helpers_to!(Fortitude::Widget)
28
- end
29
-
30
- if ::Rails.env.development?
31
- ::Fortitude::Widget.class_eval do
32
- format_output true
33
- start_and_end_comments true
34
- debug true
35
- end
36
- end
37
- end
38
-
39
- initializer :fortitude, :before => :set_autoload_paths do |app|
40
- # All of this code is involved in setting up autoload_paths to work with Fortitude.
41
- # Why so hard?
42
- #
43
- # We're trying to do something that ActiveSupport::Dependencies -- which is what Rails uses for
44
- # class autoloading -- doesn't really support. We want app/views to be on the autoload path,
45
- # because there are now Ruby classes living there. (It usually isn't just because all that's there
46
- # are template source files, not actual Ruby code.) That isn't an issue, though -- adding it
47
- # is trivial (just do
48
- # <tt>ActiveSupport::Dependencies.autoload_paths << File.join(Rails.root, 'app/views')</tt>).
49
- #
50
- # The real issue is that we want the class <tt>app/views/foo/bar.rb</tt> to define a class called
51
- # <tt>Views::Foo::Bar</tt>, not just plain <tt>Foo::Bar</tt>. This is what's different from what
52
- # ActiveSupport::Dependencies normally supports; it expects the filesystem path underneath the
53
- # root to be exactly identical to the fully-qualified class name.
54
- #
55
- # Why are we doing this crazy thing? Because we want you to be able to have a view called
56
- # <tt>app/views/user/password.rb</tt>, and _not_ have that conflict with a module you just happen to define
57
- # elsewhere called <tt>User::Password</tt>. If we don't prefix view classes with anything at all, then the
58
- # potential for conflicts is enormous.
59
- #
60
- # As such, we have this code. We'll walk through it step-by-step; note that at the end we *do*
61
- # add app/views/ to the autoload path, so all this code is doing is just dealing with the fact that
62
- # the fully-qualified classname (<tt>Views::Foo::Bar</tt>) has one extra component on the front of it
63
- # (<tt>Views::</tt>) when compared to the subpath (<tt>foo/bar.rb</tt>) underneath what's on the autoload
64
- # path (<tt>app/views</tt>).
65
-
66
- # Go compute our views root.
67
- views_root = File.expand_path(File.join(::Rails.root, 'app', 'views'))
68
-
69
- # Now, do all this work inside ::ActiveSupport::Dependencies...
70
- ::ActiveSupport::Dependencies.module_eval do
71
- @@_fortitude_views_root = views_root
72
-
73
- # This is the method that gets called to auto-generate namespacing empty
74
- # modules (_e.g._, the toplevel <tt>Views::</tt> module) for directories
75
- # under an autoload path.
76
- #
77
- # The original method says:
78
- #
79
- # "Does the provided path_suffix correspond to an autoloadable module?
80
- # Instead of returning a boolean, the autoload base for this module is
81
- # returned."
82
- #
83
- # So, we just need to strip off the leading +views/+ from the +path_suffix+,
84
- # and see if that maps to a directory underneath <tt>app/views/</tt>; if so,
85
- # we'll return the path to <tt>.../app/views/</tt>. Otherwise, we just
86
- # delegate back to the superclass method.
87
- def autoloadable_module_with_fortitude?(path_suffix)
88
- if path_suffix =~ %r{^views(/.*)?$}i
89
- # If we got here, then we were passed a subpath of views/....
90
- subpath = $1
91
-
92
- if subpath.blank? || File.directory?(File.join(@@_fortitude_views_root, subpath))
93
- return @@_fortitude_views_root
94
- end
95
- end
96
-
97
- with_fortitude_views_removed_from_autoload_path do
98
- autoloadable_module_without_fortitude?(path_suffix)
99
- end
100
- end
101
-
102
- alias_method_chain :autoloadable_module?, :fortitude
103
-
104
- # When we delegate back to original methods, we want them to act as if
105
- # <tt>app/views/</tt> is _not_ on the autoload path. In order to be thread-safe
106
- # about that, we couple this method with our override of the writer side of the
107
- # <tt>mattr_accessor :autoload_paths</tt>, which simply prefers the thread-local
108
- # that we set to the actual underlying variable.
109
- def with_fortitude_views_removed_from_autoload_path
110
- begin
111
- Thread.current[:_fortitude_autoload_paths_override] = autoload_paths - [ @@_fortitude_views_root ]
112
- yield
113
- ensure
114
- Thread.current[:_fortitude_autoload_paths_override] = nil
115
- end
116
- end
117
-
118
- # The use of 'class_eval' here may seem funny, and I think it is, but, without it,
119
- # the +@@autoload_paths+ gets interpreted as a class variable for this *Railtie*,
120
- # rather than for ::ActiveSupport::Dependencies. (Why is that? Got me...)
121
- class_eval <<-EOS
122
- def self.autoload_paths
123
- Thread.current[:_fortitude_autoload_paths_override] || @@autoload_paths
124
- end
125
- EOS
126
-
127
- # The original method says:
128
- #
129
- # "Search for a file in autoload_paths matching the provided suffix."
130
- #
131
- # So, we just look to see if the given +path_suffix+ is specifying something like
132
- # <tt>views/foo/bar</tt>; if so, we glue it together properly, removing the initial
133
- # <tt>views/</tt> first. (Otherwise, the mechanism would expect
134
- # <tt>Views::Foo::Bar</tt> to show up in <tt>app/views/views/foo/bar</tt> (yes, a double
135
- # +views+), since <tt>app/views</tt> is on the autoload path.)
136
- def search_for_file_with_fortitude(path_suffix)
137
- # This just makes sure our path always ends in exactly one ".rb", whether it started
138
- # with one or not.
139
- new_path_suffix = path_suffix.sub(/(\.rb)?$/, ".rb")
140
-
141
- if new_path_suffix =~ %r{^views(/.*)$}i
142
- path = File.join(@@_fortitude_views_root, $1)
143
- return path if File.file?(path)
144
- end
145
-
146
- # Make sure that we remove the views autoload path before letting the rest of
147
- # the dependency mechanism go searching for files, or else <tt>app/views/foo/bar.rb</tt>
148
- # *will* be found when looking for just <tt>::Foo::Bar</tt>.
149
- with_fortitude_views_removed_from_autoload_path { search_for_file_without_fortitude(path_suffix) }
150
- end
151
-
152
- alias_method_chain :search_for_file, :fortitude
153
- end
154
-
155
- # And, finally, this is where we add our root to the set of autoload paths.
156
- ::ActiveSupport::Dependencies.autoload_paths << views_root
157
-
158
- # This is our support for partials. Fortitude doesn't really have a distinction between
159
- # partials and "full" templates -- everything is just a widget, which is much more elegant --
160
- # but we still want you to be able to render a widget <tt>Views::Foo::Bar</tt> by saying
161
- # <tt>render :partial => 'foo/bar'</tt> (from ERb, although you can do it from Fortitude if
162
- # you want for some reason, too).
163
- #
164
- # Normally, ActionView only looks for partials in files starting with an underscore. We
165
- # do want to allow this, too (in the above case, if you define the widget in the file
166
- # <tt>app/views/foo/_bar.rb</tt>, it will still work fine); however, we also want to allow
167
- # you to define it in a file that does _not_ start with an underscore ('cause these are
168
- # Ruby classes, and that's just plain weird).
169
- #
170
- # So, we patch #find_templates: if it's looking for a partial, doesn't find one, and is
171
- # searching Fortitude templates (the +.rb+ handler), then we try again, turning off the
172
- # +partial+ flag, and return that instead.
173
- ::ActionView::PathResolver.class_eval do
174
- def find_templates_with_fortitude(name, prefix, partial, details)
175
- templates = find_templates_without_fortitude(name, prefix, partial, details)
176
- if partial && templates.empty? && details[:handlers] && details[:handlers].include?(:rb)
177
- templates = find_templates_without_fortitude(name, prefix, false, details.merge(:handlers => [ :rb ]))
178
- end
179
- templates
180
- end
181
-
182
- alias_method_chain :find_templates, :fortitude
183
- end
184
-
185
- require "fortitude/rails/template_handler"
186
-
187
- # This is our support for render :widget. Although, originally, it looked like creating a new subclass
188
- # of ActionView::Template was going to be the correct thing to do here, it turns out it isn't: the entire
189
- # template system is predicated around the idea that you have a template, which is compiled to output
190
- # Ruby source code, and then that gets evaluated to actually generate output.
191
- #
192
- # Because <tt>render :widget => ...</tt> takes an already-instantiated widget as input, this simply isn't
193
- # possible: you can't reverse-engineer an arbitrary Ruby object into source code, and, without source code,
194
- # the whole templating paradigm doesn't make sense.
195
- #
196
- # So, instead, we simply transform <tt>render :widget => ...</tt> into a <tt>render :text => ...</tt> of the
197
- # widget's output, and let Rails take it away from there.
198
- ::ActionController::Base.class_eval do
199
- def fortitude_rendering_context(options)
200
- @_fortitude_rendering_context ||= create_fortitude_rendering_context(options)
201
- end
202
-
203
- def create_fortitude_rendering_context(options)
204
- ::Fortitude::RenderingContext.new(options)
205
- end
206
-
207
- def render_with_fortitude(*args, &block)
208
- if (options = args[0]).kind_of?(Hash)
209
- if (widget = options[:widget])
210
- rendering_context = fortitude_rendering_context(:delegate_object => self)
211
- widget.to_html(rendering_context)
212
-
213
- options = options.dup
214
- options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
215
- options[:layout] = true unless options.has_key?(:layout)
216
-
217
- new_args = [ options ] + args[1..-1]
218
- return render_without_fortitude(*new_args, &block)
219
- elsif (widget_block = options[:inline]) && (options[:type] == :fortitude)
220
- options.delete(:inline)
221
-
222
- rendering_context = fortitude_rendering_context(:delegate_object => self)
223
- widget_class = Class.new(Fortitude::Widgets::Html5)
224
- widget_class.use_instance_variables_for_assigns(true)
225
- widget_class.extra_assigns(:use)
226
- widget_class.send(:define_method, :content, &widget_block)
227
-
228
- assigns = { }
229
- instance_variables.each do |ivar_name|
230
- value = instance_variable_get(ivar_name)
231
- assigns[$1.to_sym] = value if ivar_name =~ /^@(.*)$/
232
- end
233
- assigns = assigns.merge(options[:locals] || { })
234
-
235
- widget = widget_class.new(assigns)
236
- widget.to_html(rendering_context)
237
-
238
- options = options.dup
239
- options[:text] = rendering_context.output_buffer_holder.output_buffer.html_safe
240
- options[:layout] = true unless options.has_key?(:layout)
241
-
242
- new_args = [ options ] + args[1..-1]
243
- return render_without_fortitude(*new_args, &block)
244
- end
245
- end
246
-
247
- return render_without_fortitude(*args, &block)
248
- end
249
-
250
- alias_method_chain :render, :fortitude
251
- end
252
- end
253
- end
254
- end