roxo 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,8 @@
1
- == What is?
1
+ ## What is?
2
2
 
3
3
  ROXO (Ruby Objects for XML Objects) is a simple wrapper that uses LibXML to let you traverse an XML document using ruby method calls.
4
4
 
5
- == How do I make it go?
5
+ ## How do I make it go?
6
6
 
7
7
  require 'roxo'
8
8
  roxo = ROXO.new("<foo bar='zxcv'><qux><quux>corge</quux></qux><qux>grault</qux></foo>")
@@ -10,7 +10,7 @@ ROXO (Ruby Objects for XML Objects) is a simple wrapper that uses LibXML to let
10
10
  roxo.quxes #=> [#<ROXO:0x03158150>, "grault"]
11
11
  roxo.quxes.first.quux #=> "corge"
12
12
 
13
- == Is there anything else I need to know?
13
+ ## Is there anything else I need to know?
14
14
 
15
15
  No.
16
16
 
data/lib/roxo.rb CHANGED
@@ -33,20 +33,21 @@ class ROXO
33
33
  end
34
34
 
35
35
  def <=>(other)
36
- [:class, :__attributes, :value, :name].each do |key|
37
- return z unless (z = self.send(key) <=> other.send(key)).zero?
38
- end
36
+ return z unless (z = self.class <=> other.class ).zero?
37
+ return z unless (z = self.__attributes <=> other.__attributes).zero?
38
+ return z unless (z = self.value <=> other.value ).zero?
39
+ return z unless (z = self.name <=> other.name ).zero?
39
40
  nodes = lambda{|obj|obj.children.values.flatten.map{|n|self.class.new(n)}}
40
41
  nodes[self] <=> nodes[other]
41
42
  end
42
43
 
43
44
  def method_missing(sym, *args)
44
- if @children_by_name[sym]
45
- return self.class.new(@children_by_name[sym].first)
45
+ if @children[sym]
46
+ return self.class.new(@children[sym].first)
46
47
  elsif @attributes[sym.to_s]
47
48
  return @attributes[sym.to_s]
48
- elsif @children_by_name[sing = sym.to_s.singularize.to_sym]
49
- return @children_by_name[sing].map{|e|self.class.new(e)}
49
+ elsif @children[sing = sym.to_s.singularize.to_sym]
50
+ return @children[sing].map{|e|self.class.new(e)}
50
51
  end
51
52
  end
52
53
 
data/roxo.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |gem|
2
2
  gem.name = 'roxo'
3
- gem.version = "0.1.0"
3
+ gem.version = "0.1.2"
4
4
 
5
5
  gem.author, gem.email = 'Burke Libbey', "burke@burkelibbey.org"
6
6
 
@@ -16,7 +16,7 @@ Gem::Specification.new do |gem|
16
16
 
17
17
  gem.files = %w[
18
18
  MIT-LICENSE
19
- README
19
+ README.md
20
20
  lib
21
21
  lib/roxo.rb
22
22
  roxo.gemspec
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 0
9
- version: 0.1.0
8
+ - 2
9
+ version: 0.1.2
10
10
  platform: ruby
11
11
  authors:
12
12
  - Burke Libbey
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-04-19 00:00:00 -05:00
17
+ date: 2010-04-20 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -51,10 +51,10 @@ extra_rdoc_files: []
51
51
 
52
52
  files:
53
53
  - MIT-LICENSE
54
- - README
54
+ - README.md
55
55
  - lib/roxo.rb
56
56
  - roxo.gemspec
57
- has_rdoc: true
57
+ has_rdoc: false
58
58
  homepage:
59
59
  licenses: []
60
60