Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Plucky.modifier?

  • Loading branch information...
commit 92bda90208fe0024e1688148f89d4785d9896b6e 1 parent d1ac9bf
@jnunemaker jnunemaker authored
Showing with 28 additions and 0 deletions.
  1. +6 −0 lib/plucky.rb
  2. +22 −0 spec/plucky_spec.rb
View
6 lib/plucky.rb
@@ -23,4 +23,10 @@ def self.to_object_id(value)
value
end
end
+
+ ModifierString = '$'
+
+ def self.modifier?(key)
+ key.to_s[0] == ModifierString
+ end
end
View
22 spec/plucky_spec.rb
@@ -28,6 +28,28 @@
end
end
+ describe ".modifier?" do
+ context "with a string" do
+ it "returns true if modifier" do
+ Plucky.modifier?('$in').should be_true
+ end
+
+ it "returns false if not modifier" do
+ Plucky.modifier?('nope').should be_false
+ end
+ end
+
+ context "with a symbol" do
+ it "returns true if modifier" do
+ Plucky.modifier?(:$in).should be_true
+ end
+
+ it "returns false if not modifier" do
+ Plucky.modifier?(:nope).should be_false
+ end
+ end
+ end
+
describe "::Methods" do
it "returns array of methods" do
Plucky::Methods.should == [
Please sign in to comment.
Something went wrong with that request. Please try again.