Module: AppParser::AppIcon

Included in:
Apk, Ipa
Defined in:
lib/app_parser/app_icon.rb

Instance Method Summary collapse

Instance Method Details

#icon(dimensions:) ⇒ Object



2
3
4
5
# File 'lib/app_parser/app_icon.rb', line 2

def icon(dimensions:)
  dimensions = [dimensions, dimensions] unless dimensions.is_a? Array
  icons.find { |icon| icon[:dimensions] == dimensions }
end

#largest_iconObject



7
8
9
# File 'lib/app_parser/app_icon.rb', line 7

def largest_icon
  sorted_icons.last
end

#smallest_iconObject



11
12
13
# File 'lib/app_parser/app_icon.rb', line 11

def smallest_icon
  sorted_icons.first
end

#sorted_iconsObject



15
16
17
# File 'lib/app_parser/app_icon.rb', line 15

def sorted_icons
  icons.sort_by { |icon| icon[:dimensions].first * icon[:dimensions].last }
end