lib/code/object/boolean.rb in code-ruby-0.9.1 vs lib/code/object/boolean.rb in code-ruby-0.9.2
- old
+ new
@@ -4,10 +4,14 @@
class Object
class Boolean < ::Code::Object
attr_reader :raw
def initialize(raw)
- @raw = raw
+ if raw.is_a?(Object)
+ @raw = raw.truthy?
+ else
+ @raw = !!raw
+ end
end
def self.name
"Boolean"
end