Class: AtRandom::AtCmd
- Inherits:
-
Object
- Object
- AtRandom::AtCmd
- Defined in:
- lib/at-random/at_cmd.rb
Defined Under Namespace
Classes: InvalidTime
Instance Method Summary collapse
- #exec ⇒ Object
-
#initialize(*args) ⇒ AtCmd
constructor
A new instance of AtCmd.
Constructor Details
#initialize(*args) ⇒ AtCmd
Returns a new instance of AtCmd.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/at-random/at_cmd.rb', line 5 def initialize(*args) if args[0] timespec = args.shift if !(timespec =~ /[0-2][0-9]:[0-5][0-9]/) raise ArgumentError end if timespec < Time.now.strftime('%H:%M') raise InvalidTime, "Timespec #{timespec} is earlier than now" end @exec_args = ['at', args, timespec].flatten end end |
Instance Method Details
#exec ⇒ Object
20 21 22 |
# File 'lib/at-random/at_cmd.rb', line 20 def exec Kernel.exec(*@exec_args) end |