1- require "active_support/core_ext"
21require "nokogiri"
32require "representative/abstract_xml"
43require "representative/empty"
54
65module Representative
7-
6+
87 # Easily generate XML while traversing an object-graph.
98 #
109 class Nokogiri < AbstractXml
11-
10+
1211 def initialize ( subject = nil , options = { } )
1312 super ( subject , options )
1413 @doc = ::Nokogiri ::XML ::Document . new
@@ -35,7 +34,7 @@ def comment(text)
3534 comment_node = ::Nokogiri ::XML ::Comment . new ( doc , " #{ text } " )
3635 current_element . add_child ( comment_node )
3736 end
38-
37+
3938 def attribute ( name , value_generator = name )
4039 attribute_name = name . to_s . dasherize
4140 value = resolve_value ( value_generator )
@@ -45,7 +44,7 @@ def attribute(name, value_generator = name)
4544 end
4645
4746 private
48-
47+
4948 def generate_element ( name , resolved_attributes , content_string )
5049 tag_args = [ content_string , resolved_attributes ] . compact
5150 new_element = doc . create_element ( name , *tag_args )
@@ -54,13 +53,13 @@ def generate_element(name, resolved_attributes, content_string)
5453 old_element = @current_element
5554 begin
5655 @current_element = new_element
57- yield
56+ yield
5857 ensure
5958 @current_element = old_element
6059 end
6160 end
6261 end
63-
62+
6463 end
65-
64+
6665end
0 commit comments