Sha256: d9752ec24b1bdb88dcfee7488da88af2a6b5d2d126bbb5f9ad79f2d9e2bebe79
Contents?: true
Size: 780 Bytes
Versions: 2
Compression:
Stored size: 780 Bytes
Contents
require 'movingsign_api/commands/internal/pretty_keyable' require 'movingsign_api/commands/internal/utilities' module MovingsignApi # Text display pause setting (in seconds, 0 - 9) class DisplayPause include Utilities # @return [Integer] seconds attr_accessor :seconds # @param seconds [Integer] Time to pause (in seconds) (0 - 9) def initialize(seconds) @seconds = parse_seconds(seconds) end def to_bytes string_to_ascii_bytes self.seconds end private def parse_seconds(input) if input.kind_of?(String) && input.match(/\A[0-9]\z/) input.to_i elsif input.kind_of?(Fixnum) && input.between?(0, 9) input else raise "Pause time '#{input}' is invalid." end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
movingsign_api-0.0.2 | lib/movingsign_api/commands/internal/display_pause.rb |
movingsign_api-0.0.1 | lib/movingsign_api/commands/internal/display_pause.rb |