class Apkstats::Entity::Features

Attributes

values[R]

Public Class Methods

hashnize(features) click to toggle source
# File lib/apkstats/entity/feature.rb, line 95
def self.hashnize(features)
  features.values.each_with_object({}) do |feature, acc|
    acc[[feature.name, feature.not_required?]] = feature
  end
end
new(feature_arr) click to toggle source

Array<Feature>

# File lib/apkstats/entity/feature.rb, line 64
def initialize(feature_arr)
  @values = feature_arr
end

Public Instance Methods

-(other) click to toggle source
# File lib/apkstats/entity/feature.rb, line 68
def -(other)
  raise "#{self.class} cannot handle #{other.class} with the minus operator" unless other.class == Features

  self_hash = Features.hashnize(self)
  other_hash = Features.hashnize(other)

  diff_features = (self_hash.keys - other_hash.keys).map do |key|
    self_hash[key]
  end

  Features.new(diff_features)
end
eql?(other) click to toggle source
# File lib/apkstats/entity/feature.rb, line 85
def eql?(other)
  return if !other || other.class == Features

  other.values == values
end
hash() click to toggle source
# File lib/apkstats/entity/feature.rb, line 91
def hash
  values.hash
end
to_a() click to toggle source
# File lib/apkstats/entity/feature.rb, line 81
def to_a
  values.map(&:to_s)
end