lib/code/ruby.rb in code-ruby-0.5.3 vs lib/code/ruby.rb in code-ruby-0.5.4
- old
+ new
@@ -13,10 +13,12 @@
end
def to_code
if code?
raw
+ elsif nil?
+ ::Code::Object::Nothing.new
elsif true?
::Code::Object::Boolean.new(raw)
elsif false?
::Code::Object::Boolean.new(raw)
elsif string?
@@ -48,12 +50,14 @@
end
end
def from_code
if code?
- if code_boolean?
+ if code_nothing?
raw.raw
+ elsif code_boolean?
+ raw.raw
elsif code_decimal?
raw.raw
elsif code_integer?
raw.raw
elsif code_nothing?
@@ -85,10 +89,14 @@
def code?
raw.is_a?(::Code::Object)
end
+ def nil?
+ raw.is_a?(::NilClass)
+ end
+
def true?
raw.is_a?(::TrueClass)
end
def false?
@@ -123,9 +131,13 @@
raw.is_a?(::BigDecimal)
end
def proc?
raw.is_a?(::Proc)
+ end
+
+ def code_nothing?
+ raw.is_a?(::Code::Object::Nothing)
end
def code_boolean?
raw.is_a?(::Code::Object::Boolean)
end