Class: RSpecUUID::Matchers::UUIDMatcher
- Inherits:
-
Object
- Object
- RSpecUUID::Matchers::UUIDMatcher
- Defined in:
- lib/rspec-uuid/matchers.rb
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message ⇒ Object
- #failure_message_when_negated ⇒ Object
- #matches?(obj) ⇒ Boolean
Instance Method Details
#description ⇒ Object
11 12 13 |
# File 'lib/rspec-uuid/matchers.rb', line 11 def description "be a UUID" end |
#failure_message ⇒ Object
15 16 17 |
# File 'lib/rspec-uuid/matchers.rb', line 15 def "expected a UUID" end |
#failure_message_when_negated ⇒ Object
19 20 21 |
# File 'lib/rspec-uuid/matchers.rb', line 19 def "did not expect a UUID" end |
#matches?(obj) ⇒ Boolean
4 5 6 7 8 9 |
# File 'lib/rspec-uuid/matchers.rb', line 4 def matches?(obj) return false unless obj.is_a?(String) # https://www.uuidtools.com/what-is-uuid obj.match? /^\h{8}-\h{4}-\h{4}-\h{4}-\h{12}$/ end |