Method: String::Mask#&
- Defined in:
- lib/strmask.rb
#&(other) ⇒ Object
Mask AND. Only where they are then same filters through.
"abc..123" "ab..789."
& "ab..789." | "abc..123"
---------- ----------
"ab......" "ab......"
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/strmask.rb', line 149 def &(other) other = convert(other) i = 0 o = '' while i < to_str.size if (c = to_str[i,1]) == other[i,1] o << c else o << ESC end i += 1 end self.class.new(o) end |