Skip to content

Commit

Permalink
adding a hack for the slop decorator. fixes #330
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Oct 15, 2010
1 parent fe81a19 commit d9f41bf
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.rdoc
Expand Up @@ -14,6 +14,7 @@
* Unclosed tags parsed more robustly in fragments. #315
* XML::Node#{replace,add_previous_sibling,add_next_sibling} edge cases fixed related to libxml's text node merging. #308
* Fixed a segfault when GC occurs during xpath handler argument marshalling. #345
* Added hack to Slop decorator to work with previously defined methods. #330

=== 1.4.3 / 2010/07/28

Expand Down
2 changes: 2 additions & 0 deletions Manifest.txt
Expand Up @@ -205,6 +205,7 @@ test/css/test_nthiness.rb
test/css/test_parser.rb
test/css/test_tokenizer.rb
test/css/test_xpath_visitor.rb
test/decorators/test_slop.rb
test/ffi/test_document.rb
test/files/2ch.html
test/files/address_book.rlx
Expand Down Expand Up @@ -277,3 +278,4 @@ test/xml/test_syntax_error.rb
test/xml/test_text.rb
test/xml/test_unparented_node.rb
test/xml/test_xpath.rb
test/xslt/test_custom_functions.rb
2 changes: 1 addition & 1 deletion lib/nokogiri/decorators/slop.rb
Expand Up @@ -8,7 +8,7 @@ module Slop
# look for node with +name+. See Nokogiri.Slop
def method_missing name, *args, &block
if args.empty?
list = xpath("./#{name}")
list = xpath("./#{name.to_s.sub(/^_/, '')}")
elsif args.first.is_a? Hash
hash = args.first
if hash[:css]
Expand Down
16 changes: 16 additions & 0 deletions test/decorators/test_slop.rb
@@ -0,0 +1,16 @@
require "helper"

module Nokogiri
class TestSlop < Nokogiri::TestCase
def test_description_tag
doc = Nokogiri.Slop(<<-eoxml)
<item>
<title>foo</title>
<description>this is the foo thing</description>
</item>
eoxml
assert doc.item.title
assert doc.item._description, 'should have description'
end
end
end

0 comments on commit d9f41bf

Please sign in to comment.