class MatchData

Class MatchData

Modifies the operator {#==} so it can be compared with {MatchSkeleton}.

Public Instance Methods

==(obj) click to toggle source

Compares with {MatchSkeleton}, in addition to {MatchData}

@param obj [#string, regexp, pre_match] All the methods have to be there. Practically, {MatchSkeleton} and {MatchData} @return [Boolean]

# File lib/match_skeleton/match_data.rb, line 15
def ==(obj)
  !!((defined?(obj.string)    && string    == obj.string) &&
     (defined?(obj.regexp)    && regexp    == obj.regexp) &&
     (defined?(obj.pre_match) && pre_match == obj.pre_match))
  # nb., defined?() can return nil, and then nil (not false) will be returned.
end
Also aliased as: equal_before_match_skeleton
equal_before_match_skeleton(obj)

Backup alias for {MatchData#==}

Alias for: ==