summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBen Schwarz <ben.schwarz@gmail.com>2010-01-14 06:59:43 +0800
committerMichael Bleigh <michael@intridea.com>2010-01-14 07:14:09 +0800
commit0552fc42953b7505c1a848d8861e7ac7d0c25653 (patch)
tree25674624007f94f58dd952cc54fbf62a44161fa4 /lib
parent3b4d730745dae8a8bf3751348d9aa650efd2d317 (diff)
downloadhashie-0552fc42953b7505c1a848d8861e7ac7d0c25653.tar.gz
Storing dash properties in a class variable to allow for subclassing (#Issue 2)
Diffstat (limited to 'lib')
-rw-r--r--lib/hashie/dash.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/hashie/dash.rb b/lib/hashie/dash.rb
index 47b0afe..3d73090 100644
--- a/lib/hashie/dash.rb
+++ b/lib/hashie/dash.rb
@@ -26,8 +26,8 @@ module Hashie
def self.property(property_name, options = {})
property_name = property_name.to_sym
- (@properties ||= []) << property_name
- (@defaults ||= {})[property_name] = options.delete(:default)
+ (@@properties ||= []) << property_name
+ (@@defaults ||= {})[property_name] = options.delete(:default)
class_eval <<-RUBY
def #{property_name}
@@ -43,7 +43,7 @@ module Hashie
# Get a String array of the currently defined
# properties on this Dash.
def self.properties
- @properties.collect{|p| p.to_s}
+ @@properties.collect{|p| p.to_s}
end
# Check to see if the specified property has already been
@@ -54,7 +54,7 @@ module Hashie
# The default values that have been set for this Dash
def self.defaults
- @defaults
+ @@defaults
end
# You may initialize a Dash with an attributes hash