Class: CheekyDreams::Dev::DreamCheeky
- Inherits:
-
Object
- Object
- CheekyDreams::Dev::DreamCheeky
- Defined in:
- lib/cheeky-dreams.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #go(rgb) ⇒ Object
-
#initialize(path, max_threshold = 50) ⇒ DreamCheeky
constructor
A new instance of DreamCheeky.
Constructor Details
#initialize(path, max_threshold = 50) ⇒ DreamCheeky
Returns a new instance of DreamCheeky.
212 213 214 |
# File 'lib/cheeky-dreams.rb', line 212 def initialize path, max_threshold = 50 @path, @max_threshold = path, max_threshold end |
Instance Attribute Details
#path ⇒ Object (readonly)
Returns the value of attribute path.
211 212 213 |
# File 'lib/cheeky-dreams.rb', line 211 def path @path end |
Instance Method Details
#go(rgb) ⇒ Object
216 217 218 219 220 221 |
# File 'lib/cheeky-dreams.rb', line 216 def go rgb worked = system "echo #{using_threshold(rgb[0])} > #{path}/red" raise "Failed to update #{path}/red, do you have permissions to write to that file??" unless worked system "echo #{using_threshold(rgb[1])} > #{path}/green" system "echo #{using_threshold(rgb[2])} > #{path}/blue" end |