Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

adding a hack for the slop decorator. fixes #330

  • Loading branch information...
commit d9f41bf027bc6c7caf5d426ee5303c2939ea2e3a 1 parent fe81a19
@tenderlove tenderlove authored
View
1  CHANGELOG.rdoc
@@ -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
View
2  Manifest.txt
@@ -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
@@ -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
View
2  lib/nokogiri/decorators/slop.rb
@@ -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]
View
16 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
Please sign in to comment.
Something went wrong with that request. Please try again.