class AppscreensIoUploader::Screenshot
Represents one screenshot
Attributes
language[RW]
path[RW]
screen_size[RW]
size[RW]
Public Class Methods
new(path)
click to toggle source
path: Path to screenshot color: Color to use for the frame
# File lib/appscreensIoUploader/screenshot.rb, line 11 def initialize(path) raise "Couldn't find file at path '#{path}'".red unless File.exists?path @path = path @size = FastImage.size(path) matched_language = /\/([a-zA-Z]{2})-/.match(path) if matched_language @language = matched_language.captures[0] else @language = 'en' Helper.log.info "cannot find language in filename fallback to 'en' file: #{path}" end @screen_size = Deliver::AppScreenshot.calculate_screen_size(path) end
Public Instance Methods
is_portrait?()
click to toggle source
# File lib/appscreensIoUploader/screenshot.rb, line 51 def is_portrait? return (orientation_name == Orientation::PORTRAIT) end
is_supported_screen_size?()
click to toggle source
# File lib/appscreensIoUploader/screenshot.rb, line 27 def is_supported_screen_size? sizes = Deliver::AppScreenshot::ScreenSize case @screen_size when sizes::IOS_55 return true when sizes::IOS_47 return true when sizes::IOS_40 return true when sizes::IOS_35 return false when sizes::IOS_IPAD return false when sizes::MAC return false end end
orientation_name()
click to toggle source
The name of the orientation of a screenshot. Used to find the correct template
# File lib/appscreensIoUploader/screenshot.rb, line 46 def orientation_name return Orientation::PORTRAIT if size[0] < size[1] return Orientation::LANDSCAPE end
to_s()
click to toggle source
# File lib/appscreensIoUploader/screenshot.rb, line 55 def to_s self.path end