Permalink
Browse files

Removed the 'to_s' indirection in @attributes and @elements.

It currently doesn't have any function and I'm assuming it
exists for historical reasons.
  • Loading branch information...
1 parent 625a606 commit 2f3ad8f7375c0c407fedb4e4c7067007201004bb Ivo Wever committed Dec 24, 2012
Showing with 6 additions and 8 deletions.
  1. +6 −8 lib/happymapper.rb
View
@@ -10,8 +10,8 @@ module HappyMapper
DEFAULT_NS = "happymapper"
def self.included(base)
- base.instance_variable_set("@attributes", {})
- base.instance_variable_set("@elements", {})
+ base.instance_variable_set("@attributes", [])
+ base.instance_variable_set("@elements", [])
base.instance_variable_set("@registered_namespaces", {})
base.instance_variable_set("@wrapper_anonymous_classes", {})
@@ -37,8 +37,7 @@ module ClassMethods
#
def attribute(name, type, options={})
attribute = Attribute.new(name, type, options)
- @attributes[to_s] ||= []
- @attributes[to_s] << attribute
+ @attributes << attribute
attr_accessor attribute.method_name.intern
end
@@ -49,7 +48,7 @@ def attribute(name, type, options={})
# an empty array is returned when there have been no attributes defined.
#
def attributes
- @attributes[to_s] || []
+ @attributes
end
#
@@ -93,8 +92,7 @@ def register_namespace(namespace, ns)
#
def element(name, type, options={})
element = Element.new(name, type, options)
- @elements[to_s] ||= []
- @elements[to_s] << element
+ @elements << element
attr_accessor element.method_name.intern
end
@@ -106,7 +104,7 @@ def element(name, type, options={})
# defined.
#
def elements
- @elements[to_s] || []
+ @elements
end
#

0 comments on commit 2f3ad8f

Please sign in to comment.