Permalink
Browse files

refactor

  • Loading branch information...
1 parent c777c82 commit 72aee5aba7c05e3376acfbf0f087790973cb0fe3 @kachick committed Apr 14, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 lib/instancevalue.rb
View
16 lib/instancevalue.rb
@@ -22,7 +22,9 @@
# person.age #=> age at runtime
# person.instance_eval{val :birthday, Time.now} #=> Exception
module InstanceValue
+
VERSION = '0.0.3'.freeze
+ VALUES_KEYSTORE_NAME = :VALUES_KEYSTORE
module Eigen
private
@@ -74,19 +76,20 @@ def inspect
}
end
- private
+ protected
def _values
- if singleton_class.const_defined? :VALUES
- singleton_class::VALUES
+ if singleton_class.const_defined? VALUES_KEYSTORE_NAME
+ singleton_class.const_get VALUES_KEYSTORE_NAME
else
- singleton_class.const_set :VALUES, {}
+ singleton_class.const_set VALUES_KEYSTORE_NAME, {}
end
end
+ private
+
def initialize_copy(original)
- singleton_class.const_set :VALUES,
- original.singleton_class::VALUES.dup
+ singleton_class.const_set VALUES_KEYSTORE_NAME, original._values.dup
end
def remove_instance_value(name)
@@ -110,4 +113,5 @@ def val(name, *values)
raise ArgumentError, "wrong number of Argument #{values.length} for 1 or 2"
end
end
+
end

0 comments on commit 72aee5a

Please sign in to comment.