Sha256: 109f16724a2dbaf4e522abbac3af84208ec82ca5bb08c74382cbdb5bb63450ef
Contents?: true
Size: 822 Bytes
Versions: 1
Compression:
Stored size: 822 Bytes
Contents
# frozen_string_literal: true require 'English' module TimeBlock class Agent class MissingPackageError < StandardError; end def initialize(time) raise MissingPackageError.new('No terminal-notifier, please install it, brew install terminal-notifier') unless terminal_notifier_exist? @time = time end def run pre_callback sleep @time post_callback end private def terminal_notifier_exist? `which terminal-notifier` $CHILD_STATUS.success? end def pre_callback `terminal-notifier -message #{'Time is starting !!!'.dump} -title "TimeBlock - #{@time}s" -sound "default"` end def post_callback `terminal-notifier -message #{'Time is out dude !!!'.dump} -title "TimeBlock - #{@time}s" -sound "default"` end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
time_block-0.2.0 | lib/time_block/agent.rb |