Class: Apkstats::Entity::ApkInfoDiff

Inherits:
Object
  • Object
show all
Defined in:
lib/apkstats/entity/apk_info_diff.rb

Constant Summary collapse

KEYS =
Apkstats::Entity::ApkInfo::KEYS

Instance Method Summary collapse

Constructor Details

#initialize(base, other) ⇒ ApkInfoDiff

Returns a new instance of ApkInfoDiff.



12
13
14
15
# File 'lib/apkstats/entity/apk_info_diff.rb', line 12

def initialize(base, other)
  @base = base
  @other = other
end

Instance Method Details

#dex_countObject



72
73
74
75
# File 'lib/apkstats/entity/apk_info_diff.rb', line 72

def dex_count
  # Integer
  @base[__method__].to_i - @other[__method__].to_i
end

#download_sizeObject



28
29
30
31
# File 'lib/apkstats/entity/apk_info_diff.rb', line 28

def download_size
  # Integer
  @base[__method__].to_i - @other[__method__].to_i
end

#file_sizeObject



23
24
25
26
# File 'lib/apkstats/entity/apk_info_diff.rb', line 23

def file_size
  # Integer
  @base[__method__].to_i - @other[__method__].to_i
end

#method_reference_countObject



67
68
69
70
# File 'lib/apkstats/entity/apk_info_diff.rb', line 67

def method_reference_count
  # Integer
  @base[__method__].to_i - @other[__method__].to_i
end

#min_sdkObject



57
58
59
60
# File 'lib/apkstats/entity/apk_info_diff.rb', line 57

def min_sdk
  # String
  [@base[__method__], @other[__method__]].uniq
end

#non_required_featuresObject



41
42
43
44
45
46
47
# File 'lib/apkstats/entity/apk_info_diff.rb', line 41

def non_required_features
  # Features
  {
      new: (@base[__method__] - @other[__method__]).to_a,
      removed: (@other[__method__] - @base[__method__]).to_a,
  }
end

#permissionsObject



49
50
51
52
53
54
55
# File 'lib/apkstats/entity/apk_info_diff.rb', line 49

def permissions
  # Permissions
  {
      new: (@base[__method__] - @other[__method__]).to_a,
      removed: (@other[__method__] - @base[__method__]).to_a,
  }
end

#required_featuresObject



33
34
35
36
37
38
39
# File 'lib/apkstats/entity/apk_info_diff.rb', line 33

def required_features
  # Features
  {
      new: (@base[__method__] - @other[__method__]).to_a,
      removed: (@other[__method__] - @base[__method__]).to_a,
  }
end

#target_sdkObject



62
63
64
65
# File 'lib/apkstats/entity/apk_info_diff.rb', line 62

def target_sdk
  # String
  [@base[__method__], @other[__method__]].uniq
end

#to_hObject



17
18
19
20
21
# File 'lib/apkstats/entity/apk_info_diff.rb', line 17

def to_h
  KEYS.each_with_object({}) do |key, acc|
    acc[key] = self.send(key)
  end.compact
end