lib/origen/parameters/set.rb in origen-0.7.17 vs lib/origen/parameters/set.rb in origen-0.7.18
- old
+ new
@@ -3,10 +3,14 @@
class Set < Hash
attr_accessor :top_level
attr_accessor :name
attr_accessor :path
+ # Allow these parameter names to be valid. When used, they will override the
+ # methods of the same name provided by the Hash class.
+ OVERRIDE_HASH_METHODS = [:min, :max]
+
def initialize(options = {})
if options[:top_level]
@top_level = self
@path = ''
@owner = options[:owner]
@@ -67,9 +71,19 @@
val
end
end
end
end
+ end
+ end
+ end
+
+ OVERRIDE_HASH_METHODS.each do |method|
+ define_method method do
+ if self[method]
+ method_missing(method)
+ else
+ super
end
end
end
def each