Method: String::Mask#*

Defined in:
lib/strmask.rb

#*(other) ⇒ Object

Mask XAND. Where the characters are the same, the result is the same, where they differ the result reflects the later.

  "abc..123"      "ab..789."
* "ab..789."    * "abc..123"
  ----------      ----------
  "ab..789."      "abc..123"


126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/strmask.rb', line 126

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 << other[i,1]
    end
    i += 1
  end
  self.class.new(o)
end