Method: String::Mask#^
- Defined in:
- lib/strmask.rb
#^(other) ⇒ Object
Mask XOR operation. Only where there is an empty slot will the value filter.
"abc..123" "ab..789."
| "ab..789." | "abc..123"
---------- ----------
"..c.7..3" "..c.7..3"
172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 |
# File 'lib/strmask.rb', line 172 def ^(other) other = convert(other) i = 0 o = '' while i < to_str.size if to_str[i,1] == ESC o << other[i,1] elsif other[i,1] == ESC o << to_str[i,1] else o << ESC end i += 1 end self.class.new(o) end |