structure.rb in structure-0.28.5 vs structure.rb in structure-0.28.6

- old
+ new

@@ -3,11 +3,11 @@ base.extend(ClassMethods).instance_variable_set(:@attribute_names, []) end def attributes attribute_names.reduce({}) { |ret, key| - val = self.send(key) + val = send(key) ret.update(key => if val.respond_to?(:attributes) val.attributes elsif val.is_a?(Array) @@ -30,11 +30,12 @@ def inspect class_name = self.class.name || self.class.to_s.gsub(/[^\w:]/, '') "#<#{class_name} #{ - attributes - .map { |key, val| + attribute_names + .map { |key| + val = send(key) if val.is_a?(Array) "#{key}=[#{val.take(3).map(&:inspect).join(', ')}" + (val.size > 3 ? '...' : '') + ']' else "#{key}=#{val.inspect}" end