Sha256: 9c8202aea87d7c042570e23986be2ec3d1905c789e5ade14a347fe6bf3bbcd21
Contents?: true
Size: 633 Bytes
Versions: 1
Compression:
Stored size: 633 Bytes
Contents
module BlinkStick::ActionHandler def blink(blink_color = nil, options = {}) current_color = self.color blink_color = [0, 0, 0] if blink_color.nil? options = { blink: 1, frequency: 0.2, turn_off: false }.merge(options) perform_blink(blink_color, current_color, options) end private def perform_blink(blink_color, current_color, options) options[:blink].times do sleep options[:frequency] self.color = blink_color sleep options[:frequency] if options[:turn_off] self.off else self.color = current_color end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
blink_stick-0.1.1 | lib/blink_stick/action_handler.rb |