Module: Slappy::Listener::Validatable
Instance Attribute Summary collapse
-
#pattern ⇒ Object
Returns the value of attribute pattern.
Instance Method Summary collapse
Methods included from Debuggable
Instance Attribute Details
#pattern ⇒ Object
Returns the value of attribute pattern.
6 7 8 |
# File 'lib/slappy/listeners/concerns/validatable.rb', line 6 def pattern @pattern end |
Instance Method Details
#valid?(event) ⇒ Boolean
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/slappy/listeners/concerns/validatable.rb', line 8 def valid?(event) unless time_valid?(event) Debug.log 'Event happend in before start time' return false end target = event.send(target_element) unless target Debug.log 'Target is nil' return false end event.matches = target.match pattern unless event.matches Debug.log "Target is not match pattern(#{pattern})" return false end true end |