is_same 1.0.6 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/is_same/core_ext/array.rb +1 -0
- data/lib/is_same/core_ext/class.rb +5 -3
- data/lib/is_same/core_ext/numeric.rb +5 -3
- data/lib/is_same/core_ext/object.rb +2 -0
- data/lib/is_same/core_ext/regexp.rb +4 -4
- data/lib/is_same/core_ext/string.rb +4 -4
- data/lib/is_same/core_ext/symbol.rb +5 -7
- metadata +1 -1
@@ -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
|
6
|
+
object == "#{self}"
|
6
7
|
when Symbol
|
7
|
-
object == self
|
8
|
+
object == :"#{self}"
|
8
9
|
when Regexp
|
9
|
-
!!object.match(self
|
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
|
6
|
+
object == "#{self}"
|
6
7
|
when Symbol
|
7
|
-
object == self
|
8
|
+
object == :"#{self}"
|
8
9
|
when Regexp
|
9
|
-
!!object.match(self
|
10
|
+
!!object.match("#{self}")
|
10
11
|
else
|
11
12
|
super
|
12
13
|
end
|
13
14
|
end
|
15
|
+
|
14
16
|
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
|
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
|
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
|
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
|
-
|
11
|
-
self == object.to_sym
|
12
|
-
else
|
9
|
+
else
|
13
10
|
super
|
14
11
|
end
|
15
12
|
end
|
13
|
+
|
16
14
|
end
|