lib/object.rb in machinery-tool-1.18.0 vs lib/object.rb in machinery-tool-1.19.0
- old
+ new
@@ -110,27 +110,23 @@
if args.size != 1
raise ArgumentError, "wrong number of arguments (#{args.size} for 1)"
end
key = name.to_s[0..-2]
@attributes[key] = self.class.convert_element(key, args.first)
- else
- if @attributes.has_key?(name.to_s)
- if !args.empty?
- raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
- end
-
- @attributes[name.to_s]
- else
- nil
+ elsif @attributes.key?(name.to_s)
+ unless args.empty?
+ raise ArgumentError, "wrong number of arguments (#{args.size} for 0)"
end
+
+ @attributes[name.to_s]
end
end
def respond_to?(name, include_all = false)
if name.to_s.end_with?("=")
true
else
- @attributes.has_key?(name) || super(name, include_all)
+ @attributes.key?(name) || super(name, include_all)
end
end
def initialize_copy(orig)
super