Skip to content

Commit 907089b

Browse files
author
Trung Lê
committed
Explitly require active_support/inflector instead of active_support/core_ext
1 parent b911ea3 commit 907089b

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ source "https://rubygems.org"
22

33
gemspec
44

5-
gem "rake", ">= 10.0.4"
5+
gem "rake"
66
gem "tilt"
77
gem "diff-lcs"
88
gem "ruby-prof"

lib/representative/nokogiri.rb

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
require "active_support/core_ext"
21
require "nokogiri"
32
require "representative/abstract_xml"
43
require "representative/empty"
54

65
module 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+
6665
end

lib/representative/xml.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
require "active_support/core_ext"
1+
require "active_support/inflector"
22
require "builder"
33
require "representative/abstract_xml"
44
require "representative/empty"
@@ -24,14 +24,14 @@ def initialize(xml_builder, subject = nil, options = {})
2424
def comment(text)
2525
@xml.comment!(text)
2626
end
27-
27+
2828
protected
29-
29+
3030
def generate_element(name, resolved_attributes, content_string, &content_block)
3131
tag_args = [content_string, resolved_attributes].compact
3232
@xml.tag!(name, *tag_args, &content_block)
3333
end
34-
34+
3535
end
3636

3737
end

0 commit comments

Comments
 (0)