Class: Torganiser::MatchOne

Inherits:
Object
  • Object
show all
Defined in:
lib/torganiser/match_one.rb

Overview

Creates a regex-ready string for matching one of a set of alternatives

Instance Method Summary collapse

Constructor Details

#initialize(alternatives) ⇒ MatchOne

Returns a new instance of MatchOne.



4
5
6
# File 'lib/torganiser/match_one.rb', line 4

def initialize(alternatives)
  @alternatives = alternatives
end

Instance Method Details

#to_sObject



8
9
10
# File 'lib/torganiser/match_one.rb', line 8

def to_s
  "(#{@alternatives.join('|')})"
end