class Motion::Screenshots::ScreenshotGroup

Public Class Methods

new(title, is_async, manager, &eval_block) click to toggle source
# File lib/motion/motion-screenshots.rb, line 79
def initialize(title, is_async, manager, &eval_block)
  @title = title
  @is_async = is_async
  @manager = manager
  @before_actions = nil
  @after_actions = nil
  instance_eval(&eval_block) if eval_block
end

Public Instance Methods

after(&actions) click to toggle source
# File lib/motion/motion-screenshots.rb, line 92
def after(&actions)
  @after_actions = actions
end
before(&actions) click to toggle source
# File lib/motion/motion-screenshots.rb, line 88
def before(&actions)
  @before_actions = actions
end
ready!() click to toggle source
# File lib/motion/motion-screenshots.rb, line 96
def ready!
  if @delay
    Dispatch::Queue.main.after(@delay.to_f) {
      @manager.actionIsReady
    }
  else
    @manager.actionIsReady
  end
end
ready_delay(amount) click to toggle source
# File lib/motion/motion-screenshots.rb, line 106
def ready_delay(amount)
  @delay = amount
end
to_KSScreenshotAction() click to toggle source
# File lib/motion/motion-screenshots.rb, line 110
def to_KSScreenshotAction
  KSScreenshotAction.actionWithName(@title, asynchronous: @is_async,
    actionBlock:-> { @before_actions.call if @before_actions },
    cleanupBlock: -> { @after_actions.call if @after_actions }
  )
end