roxo 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/roxo.rb +4 -4
  2. data/roxo.gemspec +1 -1
  3. metadata +2 -2
data/lib/roxo.rb CHANGED
@@ -30,11 +30,11 @@ class ROXO
30
30
  end
31
31
 
32
32
  def terminal?
33
- @children.size.zero? and @attributes.size.zero?
33
+ @children.blank? and @attributes.blank?
34
34
  end # A node is terminal if we can't descend any further
35
35
 
36
36
  def <=>(other)
37
- return z unless (z = self.class <=> other.class).zero?
37
+ return -1 unless (self.class == other.class)
38
38
  return z unless (z = self.__attributes <=> other.__attributes).zero?
39
39
  return z unless (z = self.value <=> other.value).zero?
40
40
  return z unless (z = self.name <=> other.name).zero?
@@ -46,7 +46,6 @@ class ROXO
46
46
  def ==(o)
47
47
  self.<=>(o) == 0
48
48
  end
49
-
50
49
 
51
50
  def method_missing(sym, *args)
52
51
  if terminal? # Proxy all method calls to the wrapped object.
@@ -54,7 +53,8 @@ class ROXO
54
53
  elsif sym.to_s[-1..-1]=="?" # re-dispatch without question mark, interpret result as a boolean.
55
54
  return %w{yes true t y}.include?(send(sym.to_s[0..-2].to_sym, *args).downcase)
56
55
  elsif @children[sym]
57
- return self.class.new(@children[sym].first)
56
+ x = self.class.new(@children[sym].first)
57
+ return x.terminal? ? x.value : x
58
58
  elsif @attributes[sym.to_s]
59
59
  return @attributes[sym.to_s]
60
60
  elsif @children[sing = sym.to_s.singularize.to_sym]
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.7'
3
+ gem.version = '0.1.8'
4
4
 
5
5
  gem.author, gem.email = 'Burke Libbey', "burke@burkelibbey.org"
6
6
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 1
8
- - 7
9
- version: 0.1.7
8
+ - 8
9
+ version: 0.1.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Burke Libbey