class Apkstats::Entity::Feature

Attributes

implied_reason[R]

String?

name[R]

String

Public Class Methods

new(name, not_required: false, implied_reason: nil) click to toggle source
# File lib/apkstats/entity/feature.rb, line 11
def initialize(name, not_required: false, implied_reason: nil)
  @name = name
  # cast to Boolean
  @not_required = not_required == true
  @implied_reason = implied_reason || nil
end

Public Instance Methods

==(other) click to toggle source
# File lib/apkstats/entity/feature.rb, line 36
def ==(other)
  return if !other || other.class != self.class

  to_s == other.to_s
end
eql?(other) click to toggle source
# File lib/apkstats/entity/feature.rb, line 42
def eql?(other)
  to_s.eql?(other.to_s)
end
hash() click to toggle source
# File lib/apkstats/entity/feature.rb, line 46
def hash
  h = not_required? ? 1 : 0
  h *= 31
  h += name.hash

  if implied_reason
    h *= 31
    h += implied_reason.hash
  end

  h
end
implied?() click to toggle source
# File lib/apkstats/entity/feature.rb, line 22
def implied?
  @implied_reason
end
not_required?() click to toggle source
# File lib/apkstats/entity/feature.rb, line 18
def not_required?
  @not_required
end
to_s() click to toggle source
# File lib/apkstats/entity/feature.rb, line 26
def to_s
  if implied?
    "#{name} (#{implied_reason})"
  elsif not_required?
    "#{name} (not-required)"
  else
    name
  end
end