roxo 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/roxo.rb +4 -1
- data/roxo.gemspec +1 -1
- metadata +2 -2
data/lib/roxo.rb
CHANGED
@@ -10,7 +10,6 @@ class ROXO
|
|
10
10
|
attr_reader :raw, :name, :value, :children
|
11
11
|
def __attributes; @attributes.sort; end
|
12
12
|
def attributes; @attributes.keys; end
|
13
|
-
def terminal?; @children.size.zero?; end # A node is terminal if we can't descend any further
|
14
13
|
def has?(o); !! send(o); end # Boolean. Does this exist?
|
15
14
|
def [](o); @attributes[o.to_s]; end # Only lookup attributes
|
16
15
|
def to_s; @value; end
|
@@ -27,6 +26,10 @@ class ROXO
|
|
27
26
|
terminal? ? value.inspect : "#<ROXO:0x#{object_id.to_s(16)} @name=\"#{@name}\", ...>"
|
28
27
|
end
|
29
28
|
|
29
|
+
def terminal?
|
30
|
+
@children.size.zero? and @attributes.size.zero?
|
31
|
+
end # A node is terminal if we can't descend any further
|
32
|
+
|
30
33
|
def <=>(other)
|
31
34
|
[:class, :__attributes, :value, :name].each do |key|
|
32
35
|
return z unless (z = self.send(key) <=> other.send(key)).zero?
|
data/roxo.gemspec
CHANGED