Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Copied documentation to Mash#except.

  • Loading branch information...
commit 2adc4962ac1973c785694f651f9cee2e79d79785 1 parent cb59756
@benburkert authored
Showing with 14 additions and 0 deletions.
  1. +7 −0 lib/extlib/mash.rb
  2. +7 −0 spec/mash_spec.rb
View
7 lib/extlib/mash.rb
@@ -96,6 +96,13 @@ def delete(key)
super(convert_key(key))
end
+ # @param *rejected<Array[(String, Symbol)] The mash keys to exclude.
+ #
+ # @return <Mash> A new mash without the selected keys.
+ #
+ # @example
+ # { :one => 1, :two => 2, :three => 3 }.except(:one)
+ # #=> { "two" => 2, "three" => 3 }
def except(*keys)
super(*keys.map {|k| convert_key(k)})
end
View
7 spec/mash_spec.rb
@@ -198,6 +198,13 @@
mashless.key?(:hash).should be(false)
mashless.key?("mash").should be(false)
end
+
+ it "should return a mash" do
+ mash = Mash.new(@hash)
+
+ hashless_mash = mash.except(:hash)
+ hashless_mash.class.should be(Mash)
+ end
end
Please sign in to comment.
Something went wrong with that request. Please try again.