is_same 1.0.6 → 1.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,5 @@
1
1
  class Array
2
+
2
3
  # Check if any elements of an Array is same as argument.
3
4
  #
4
5
  # @param Object
@@ -1,14 +1,16 @@
1
1
  class Class
2
+
2
3
  def matching?(object=nil, &block)
3
4
  case object
4
5
  when String
5
- object == self.name
6
+ object == "#{self}"
6
7
  when Symbol
7
- object == self.name.to_sym
8
+ object == :"#{self}"
8
9
  when Regexp
9
- !!object.match(self.name)
10
+ !!object.match("#{self}")
10
11
  else
11
12
  super
12
13
  end
13
14
  end
15
+
14
16
  end
@@ -1,14 +1,16 @@
1
1
  class Numeric
2
+
2
3
  def matching?(object=nil, &block)
3
4
  case object
4
5
  when String
5
- object == self.to_s
6
+ object == "#{self}"
6
7
  when Symbol
7
- object == self.to_s.to_sym
8
+ object == :"#{self}"
8
9
  when Regexp
9
- !!object.match(self.to_s)
10
+ !!object.match("#{self}")
10
11
  else
11
12
  super
12
13
  end
13
14
  end
15
+
14
16
  end
@@ -1,4 +1,5 @@
1
1
  class Object
2
+
2
3
  def matching?(object=nil, &block)
3
4
  if object.is_a?(Proc) or block
4
5
  object ||= block
@@ -7,4 +8,5 @@ class Object
7
8
  self == object
8
9
  end
9
10
  end
11
+
10
12
  end
@@ -1,12 +1,12 @@
1
1
  class Regexp
2
+
2
3
  def matching?(object=nil, &block)
3
4
  case object
4
- when Class
5
- !!self.match(object.name)
6
- when Numeric, String, Symbol
7
- !!self.match(object.to_s)
5
+ when Class, Numeric, String, Symbol
6
+ !!self.match("#{object}")
8
7
  else
9
8
  super
10
9
  end
11
10
  end
11
+
12
12
  end
@@ -1,14 +1,14 @@
1
1
  class String
2
+
2
3
  def matching?(object=nil, &block)
3
4
  case object
4
- when Class
5
- self == object.name
6
- when Numeric, Symbol
7
- self == object.to_s
5
+ when Class, Numeric, Symbol
6
+ self == "#{object}"
8
7
  when Regexp
9
8
  !!object.match(self)
10
9
  else
11
10
  super object, &block
12
11
  end
13
12
  end
13
+
14
14
  end
@@ -1,16 +1,14 @@
1
1
  class Symbol
2
+
2
3
  def matching?(object=nil, &block)
3
4
  case object
4
- when Class
5
- self == object.name.to_sym
6
- when Numeric
7
- self == object.to_s.to_sym
5
+ when Class, Numeric, String
6
+ self == :"#{object}"
8
7
  when Regexp
9
8
  !!object.match(self.to_s)
10
- when String
11
- self == object.to_sym
12
- else
9
+ else
13
10
  super
14
11
  end
15
12
  end
13
+
16
14
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: is_same
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.6
4
+ version: 1.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: