ruby-xquery 0.1.1.270 → 0.2.0.296

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == VERSION
4
4
 
5
- This documentation refers to ruby-xquery version 0.1.1
5
+ This documentation refers to ruby-xquery version 0.2.0
6
6
 
7
7
 
8
8
  == DESCRIPTION
data/Rakefile CHANGED
@@ -12,9 +12,10 @@ Hen.lay! {{
12
12
  },
13
13
 
14
14
  :gem => {
15
- :version => LibXML::XML::XQuery::VERSION,
16
- :summary => "Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)",
17
- :files => FileList['lib/**/*.rb'].to_a,
18
- :extra_files => FileList['[A-Z]*', 'specs/*.rb', 'test_data/*'].to_a
15
+ :version => LibXML::XML::XQuery::VERSION,
16
+ :summary => "Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)",
17
+ :files => FileList['lib/**/*.rb'].to_a,
18
+ :extra_files => FileList['[A-Z]*', 'specs/*.rb', 'test_data/*'].to_a,
19
+ :dependencies => [['libxml-ruby', '>= 0.9.3']]
19
20
  }
20
21
  }}
data/lib/libxml/xquery.rb CHANGED
@@ -32,6 +32,9 @@ end
32
32
 
33
33
  require 'libxml'
34
34
 
35
+ raise "need libxml-ruby version >= 0.9.3, got #{LibXML::XML::VERSION}" \
36
+ unless LibXML::XML::VERSION >= '0.9.3'
37
+
35
38
  # Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)
36
39
 
37
40
  module LibXML::XML::XQuery
@@ -24,26 +24,22 @@
24
24
  ###############################################################################
25
25
  #++
26
26
 
27
- module LibXML::XML::XQuery
27
+ module LibXML::XML::XQuery::EnhancedFind
28
28
 
29
- module EnhancedFind
30
-
31
- def enhanced_find(xpath)
32
- find(xpath.gsub(/\*\*/, 'descendant::node()'), namespaces)
33
- end
34
- alias_method :[], :enhanced_find
35
-
36
- def /(xpath)
37
- enhanced_find(xpath.to_s)
38
- end
29
+ def enhanced_find(xpath)
30
+ find(xpath.gsub(/\*\*/, 'descendant::node()'), namespaces)
31
+ end
32
+ alias_method :[], :enhanced_find
39
33
 
40
- def self.included(base)
41
- # overwrite original methods
42
- instance_methods.each { |method|
43
- base.send(:define_method, method, instance_method(method))
44
- }
45
- end
34
+ def /(xpath)
35
+ enhanced_find(xpath.to_s)
36
+ end
46
37
 
38
+ def self.included(base)
39
+ # overwrite original methods
40
+ instance_methods.each { |method|
41
+ base.send(:define_method, method, instance_method(method))
42
+ }
47
43
  end
48
44
 
49
45
  end
@@ -24,6 +24,14 @@
24
24
  ###############################################################################
25
25
  #++
26
26
 
27
+ class LibXML::XML::Attr
28
+
29
+ def to_s(sep = nil)
30
+ value.strip
31
+ end
32
+
33
+ end
34
+
27
35
  class LibXML::XML::Node
28
36
 
29
37
  def to_s(sep = nil)
@@ -31,3 +39,11 @@ class LibXML::XML::Node
31
39
  end
32
40
 
33
41
  end
42
+
43
+ class LibXML::XML::XPath::Object
44
+
45
+ def to_s(sep = ' | ')
46
+ map { |n| (c = n.to_s(sep)).empty? ? nil : c }.compact.join(sep)
47
+ end
48
+
49
+ end
@@ -26,13 +26,13 @@
26
26
 
27
27
  require 'forwardable'
28
28
 
29
- class LibXML::XML::Node::Set
29
+ module LibXML::XML::XQuery::Uniqueness
30
30
 
31
31
  extend Forwardable
32
32
 
33
- def_delegators :to_a, :each, :length, :size
33
+ DELEGATORS = %w[to_a each length size]
34
34
 
35
- alias_method :_xquery_original_to_a, :to_a
35
+ def_delegators *DELEGATORS
36
36
 
37
37
  def to_a
38
38
  if @_uniq
@@ -51,11 +51,11 @@ class LibXML::XML::Node::Set
51
51
  end
52
52
 
53
53
  def uniq
54
- proxy = LibXML::XML::Node::Set.new.uniq!
54
+ proxy = self.class.new.uniq!
55
55
  proxy.instance_variable_set(:@_this, self)
56
56
 
57
57
  class << proxy
58
- (instance_methods - %w[to_a each length size]).each { |method|
58
+ (instance_methods - DELEGATORS).each { |method|
59
59
  undef_method(method) unless method =~ /\A__/
60
60
  }
61
61
 
@@ -76,12 +76,19 @@ class LibXML::XML::Node::Set
76
76
  @_uniq
77
77
  end
78
78
 
79
- def contents(sep = ' | ')
80
- map { |n| (c = n.to_s(sep)).empty? ? nil : c }.compact
81
- end
79
+ def self.included(base)
80
+ base.send(:alias_method, :_xquery_original_to_a, :to_a)
82
81
 
83
- def to_s(sep = ' | ')
84
- contents(sep).join(sep)
82
+ # overwrite original methods
83
+ instance_methods.each { |method|
84
+ base.send(:define_method, method, instance_method(method))
85
+ }
85
86
  end
86
87
 
87
88
  end
89
+
90
+ class LibXML::XML::XPath::Object
91
+
92
+ include LibXML::XML::XQuery::Uniqueness
93
+
94
+ end
@@ -7,8 +7,8 @@ module LibXML
7
7
  module Version
8
8
 
9
9
  MAJOR = 0
10
- MINOR = 1
11
- TINY = 1
10
+ MINOR = 2
11
+ TINY = 0
12
12
 
13
13
  class << self
14
14
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-xquery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1.270
4
+ version: 0.2.0.296
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jens Wille
@@ -9,10 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-30 00:00:00 +02:00
12
+ date: 2008-11-24 00:00:00 +01:00
13
13
  default_executable:
14
- dependencies: []
15
-
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: libxml-ruby
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 0.9.3
24
+ version:
16
25
  description: Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)
17
26
  email: jens.wille@uni-koeln.de
18
27
  executables: []
@@ -24,12 +33,10 @@ extra_rdoc_files:
24
33
  - ChangeLog
25
34
  - README
26
35
  files:
27
- - lib/libxml/xquery/node_set.rb
28
- - lib/libxml/xquery/xpath_object.rb
29
- - lib/libxml/xquery/attr.rb
36
+ - lib/libxml/xquery/uniqueness.rb
30
37
  - lib/libxml/xquery/version.rb
38
+ - lib/libxml/xquery/string_representation.rb
31
39
  - lib/libxml/xquery/enhanced_find.rb
32
- - lib/libxml/xquery/node.rb
33
40
  - lib/libxml/xquery.rb
34
41
  - lib/xml/xquery.rb
35
42
  - COPYING
@@ -43,14 +50,14 @@ homepage: http://prometheus.rubyforge.org/ruby-xquery
43
50
  post_install_message:
44
51
  rdoc_options:
45
52
  - --line-numbers
53
+ - --main
54
+ - README
55
+ - --all
46
56
  - --inline-source
47
57
  - --title
48
58
  - ruby-xquery Application documentation
49
59
  - --charset
50
60
  - UTF-8
51
- - --main
52
- - README
53
- - --all
54
61
  require_paths:
55
62
  - lib
56
63
  required_ruby_version: !ruby/object:Gem::Requirement
@@ -68,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
68
75
  requirements: []
69
76
 
70
77
  rubyforge_project: prometheus
71
- rubygems_version: 1.2.0
78
+ rubygems_version: 1.3.1
72
79
  signing_key:
73
80
  specification_version: 2
74
81
  summary: Libxml's XPath support + plain ol' Ruby = XQuery (kind of... ;-)
@@ -1,33 +0,0 @@
1
- #--
2
- ###############################################################################
3
- # #
4
- # A component of ruby-xquery, mimicking XQuery in Ruby. #
5
- # #
6
- # Copyright (C) 2007-2008 Jens Wille #
7
- # #
8
- # Authors: #
9
- # Jens Wille <jens.wille@uni-koeln.de> #
10
- # #
11
- # ruby-xquery is free software; you can redistribute it and/or modify it #
12
- # under the terms of the GNU General Public License as published by the Free #
13
- # Software Foundation; either version 3 of the License, or (at your option) #
14
- # any later version. #
15
- # #
16
- # ruby-xquery is distributed in the hope that it will be useful, but WITHOUT #
17
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
18
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
19
- # more details. #
20
- # #
21
- # You should have received a copy of the GNU General Public License along #
22
- # with ruby-xquery. If not, see <http://www.gnu.org/licenses/>. #
23
- # #
24
- ###############################################################################
25
- #++
26
-
27
- class LibXML::XML::Attr
28
-
29
- def to_s(sep = nil)
30
- value.strip
31
- end
32
-
33
- end
@@ -1,45 +0,0 @@
1
- #--
2
- ###############################################################################
3
- # #
4
- # A component of ruby-xquery, mimicking XQuery in Ruby. #
5
- # #
6
- # Copyright (C) 2007-2008 Jens Wille #
7
- # #
8
- # Authors: #
9
- # Jens Wille <jens.wille@uni-koeln.de> #
10
- # #
11
- # ruby-xquery is free software; you can redistribute it and/or modify it #
12
- # under the terms of the GNU General Public License as published by the Free #
13
- # Software Foundation; either version 3 of the License, or (at your option) #
14
- # any later version. #
15
- # #
16
- # ruby-xquery is distributed in the hope that it will be useful, but WITHOUT #
17
- # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or #
18
- # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for #
19
- # more details. #
20
- # #
21
- # You should have received a copy of the GNU General Public License along #
22
- # with ruby-xquery. If not, see <http://www.gnu.org/licenses/>. #
23
- # #
24
- ###############################################################################
25
- #++
26
-
27
- require 'forwardable'
28
-
29
- class LibXML::XML::XPath::Object
30
-
31
- extend Forwardable
32
-
33
- def_delegators :set, :to_a, :each, :length, :size, :uniq, :uniq!, :uniq?
34
-
35
- alias_method :_xquery_original_set, :set
36
-
37
- def set
38
- @set ||= _xquery_original_set
39
- end
40
-
41
- def to_s(sep = ' | ')
42
- set.to_s(sep)
43
- end
44
-
45
- end