class Motion::Screenshots::Base

Constants

SCREENSHOTS_BASE_FOLDER

Attributes

group_by_block[RW]
screenshot_groups[RW]

Public Class Methods

async_screenshot(title, &block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 19
def async_screenshot(title, &block)
  shared.async_screenshot(title, &block)
end
group_by(&block) click to toggle source

Adds a namespace folder for this screenshot class

# File lib/motion/motion-screenshots.rb, line 15
def group_by(&block)
  shared.group_by_block = block
end
screenshot(title, &block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 23
def screenshot(title, &block)
  shared.screenshot(title, &block)
end
start!() click to toggle source
# File lib/motion/motion-screenshots.rb, line 27
def start!
  shared.start!
end

Private Class Methods

shared() click to toggle source
# File lib/motion/motion-screenshots.rb, line 32
def shared
  @shared ||= alloc.init
end

Public Instance Methods

async_screenshot(title, &block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 50
def async_screenshot(title, &block)
  @screenshot_groups << ScreenshotGroup.new(title, true, self, &block)
end
group_by(&block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 46
def group_by(&block)
  @group_by_block = block
end
init() click to toggle source
Calls superclass method KSScreenshotManager#init
# File lib/motion/motion-screenshots.rb, line 39
def init
  super
  @group_by_block = nil
  @screenshot_groups = []
  self
end
screenshot(title, &block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 54
def screenshot(title, &block)
  @screenshot_groups << ScreenshotGroup.new(title, false, self, &block)
end
setupScreenshotActions() click to toggle source
# File lib/motion/motion-screenshots.rb, line 58
def setupScreenshotActions
  @screenshot_groups.each do |sg|
    addScreenshotAction sg.to_KSScreenshotAction
  end
end
start!() click to toggle source
# File lib/motion/motion-screenshots.rb, line 64
def start!
  return if @started

  @started = true

  @documents_path = String.new(NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, true)[0])
  screenshot_path = File.join(@documents_path, SCREENSHOTS_BASE_FOLDER)
  screenshot_path = File.join(screenshot_path, group_by_block.call) if @group_by_block
  self.screenshotsURL = NSURL.fileURLWithPath(screenshot_path)

  takeScreenshots
end