Class: Torganiser::MatchOne
- Inherits:
-
Object
- Object
- Torganiser::MatchOne
- 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
-
#initialize(alternatives) ⇒ MatchOne
constructor
A new instance of MatchOne.
- #to_s ⇒ Object
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_s ⇒ Object
8 9 10 |
# File 'lib/torganiser/match_one.rb', line 8 def to_s "(#{@alternatives.join('|')})" end |