lib/hpsqrt.rb in hpsqrt-1.0.0 vs lib/hpsqrt.rb in hpsqrt-1.1.0
- old
+ new
@@ -3,13 +3,21 @@
require 'hpsqrt/version'
class HpSqrt < Numeric
- @@inspect_mode = INSPECT_MODE::DUMP
+ @@inspect_mode = INSPECT_MODE::VALUE
+ def self.inspect_mode
+ @@inspect_mode
+ end
+ def self.inspect_mode=(v)
+ @@inspect_mode = v
+ end
+
+
attr_reader :values
def initialize(values)
@values = values.freeze
freeze
@@ -197,10 +205,10 @@
case @@inspect_mode
when INSPECT_MODE::VALUE
value.to_s
when INSPECT_MODE::EXPR
expr
- when INSPECT_MODE::DUMP
+ else
"#<%s:0x%016x value=(%s) expr=(%s)>" % [self.class.name, self.object_id, value, expr]
end
end
def real?