simplify logic
This commit is contained in:
parent
4a1bccefae
commit
5e81cf2f82
@ -53,10 +53,7 @@ module BSON
|
|||||||
#
|
#
|
||||||
# @return [Boolean]
|
# @return [Boolean]
|
||||||
def self.legal?(str)
|
def self.legal?(str)
|
||||||
len = 24
|
str =~ /^[0-9a-f]{24}$/i ? true : false
|
||||||
str =~ /([0-9a-f]+)/i
|
|
||||||
match = $1
|
|
||||||
str && str.length == len && match == str
|
|
||||||
end
|
end
|
||||||
|
|
||||||
# Create an object id from the given time. This is useful for doing range
|
# Create an object id from the given time. This is useful for doing range
|
||||||
|
Loading…
Reference in New Issue
Block a user