Method: TrailGuide::Metrics::Goal#==

Defined in:
lib/trail_guide/metrics/goal.rb

#==(other) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/trail_guide/metrics/goal.rb', line 27

def ==(other)
  if other.is_a?(self.class)
    return name == other.name
  elsif other.is_a?(String) || other.is_a?(Symbol)
    other = other.to_s.underscore
    return name == other.to_sym || to_s == other
  # Currently unused placeholder for future functionality
  #elsif other.is_a?(Array)
  #  return to_s == other.flatten.map { |o| o.to_s.underscore }.join('/')
  #elsif other.is_a?(Hash)
  #  # TODO "flatten" it out and compare it to_s
  #  return false
  end
end