lib/shamu/attributes.rb in shamu-0.0.18 vs lib/shamu/attributes.rb in shamu-0.0.19
- old
+ new
@@ -49,9 +49,14 @@
attrs[name] = send( name )
end
end
+ # @return [Hash] a hash with the keys for each of the given names.
+ def slice( *names )
+ to_attributes only: names
+ end
+
# Indicates if the object has an attribute with the given name. Aliased to
# {#key?} to make the object look like a Hash.
def attribute?( name )
self.class.attributes.key?( name.to_sym )
end