Class: Expects::Handlers::Regex
- Inherits:
-
Expects::Handler
- Object
- Expects::Handler
- Expects::Handlers::Regex
- Includes:
- Expects
- Defined in:
- lib/expects/handlers/regex.rb
Constant Summary
Constants included from Expects
Instance Attribute Summary
Attributes inherited from Expects::Handler
Instance Method Summary collapse
- #build_message ⇒ Object
-
#initialize(subject, objects) ⇒ Regex
constructor
A new instance of Regex.
- #valid? ⇒ Boolean
Methods included from Expects
Methods inherited from Expects::Handler
Constructor Details
#initialize(subject, objects) ⇒ Regex
Returns a new instance of Regex.
6 7 8 9 10 |
# File 'lib/expects/handlers/regex.rb', line 6 def initialize(subject, objects) expects subject, String expects objects, Regexp super end |
Instance Method Details
#build_message ⇒ Object
16 17 18 |
# File 'lib/expects/handlers/regex.rb', line 16 def "Expected #{@subject.inspect} match \"#{@objects.inspect}\"" end |
#valid? ⇒ Boolean
12 13 14 |
# File 'lib/expects/handlers/regex.rb', line 12 def valid? @subject.match(@objects) end |