Method: Whitestone::Assertion::Match#initialize

Defined in:
lib/whitestone/assertion_classes.rb

#initialize(mode, *args, &block) ⇒ Match

Returns a new instance of Match.



208
209
210
211
212
213
214
215
216
217
218
219
220
# File 'lib/whitestone/assertion_classes.rb', line 208

def initialize(mode, *args, &block)
  super
  no_block_allowed
  args = two_arguments(args)
  unless args.map { |a| a.class }.to_set == Set[Regexp, String]
    raise AssertionSpecificationError, "Expect a String and a Regexp (any order)"
  end
  @regexp, @string = args
  if String === @regexp
    @string, @regexp = @regexp, @string
  end
  @string = Col.uncolored(@string)
end