lib/ib/extensions.rb in ib-ruby-0.8.4 vs lib/ib/extensions.rb in ib-ruby-0.8.5
- old
+ new
@@ -26,23 +26,24 @@
end
class String
def to_bool
case self.chomp.upcase
- when 'TRUE', 'T'
+ when 'TRUE', 'T', '1'
true
- when 'FALSE', 'F', ''
+ when 'FALSE', 'F', '0', ''
false
else
error "Unable to convert #{self} to bool"
end
end
end
class NilClass
+ # We still need to pass on nil, meaning: no value
def to_bool
- false
+ self
end
end
class Symbol
def to_f
@@ -54,11 +55,12 @@
to_s <=> other.to_s
end
end
class Object
+ # We still need to pass on nil, meaning: no value
def to_sup
- self.to_s.upcase
+ self.to_s.upcase unless self.nil?
end
end
### Patching Object#error in ib/errors
# def error message, type=:standard