Module: Arrow::RegexpOperators
- Included in:
- Regexp
- Defined in:
- lib/arrow/monkeypatches.rb
Overview
Add some operator methods to regular expression objects for catenation, union, etc.
Instance Method Summary
-
- (Object) +(other)
Append the given other Regexp (or String) onto a copy of the receiving one and return it.
-
- (Object) |(other)
Create and return a new Regexp that is an alternation between the receiver and the other Regexp.
Instance Method Details
- (Object) +(other)
Append the given other Regexp (or String) onto a copy of the receiving one and return it.
23 24 25 |
# File 'lib/arrow/monkeypatches.rb', line 23 def +( other ) return self.class.new( self.to_s + other.to_s ) end |
- (Object) |(other)
Create and return a new Regexp that is an alternation between the receiver and the other Regexp.
29 30 31 |
# File 'lib/arrow/monkeypatches.rb', line 29 def |( other ) return Regexp.new( "(?:%s|%s)" % [self.to_s, other.to_s] ) end |