Class: Membrane::Schemas::Regexp

Inherits:
Base
  • Object
show all
Defined in:
lib/membrane/schemas/regexp.rb

Defined Under Namespace

Classes: MatchValidator, StringValidator

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#deparse

Constructor Details

#initialize(regexp) ⇒ Regexp

Returns a new instance of Regexp.



12
13
14
# File 'lib/membrane/schemas/regexp.rb', line 12

def initialize(regexp)
  @regexp = regexp
end

Instance Attribute Details

#regexpObject (readonly)

Returns the value of attribute regexp.



10
11
12
# File 'lib/membrane/schemas/regexp.rb', line 10

def regexp
  @regexp
end

Instance Method Details

#validate(object) ⇒ Object



16
17
18
19
20
21
# File 'lib/membrane/schemas/regexp.rb', line 16

def validate(object)
  StringValidator.new(object).validate
  MatchValidator.new(@regexp, object).validate

  nil
end