Class: Hue::Config::Bridge
- Defined in:
- lib/hue/config/bridge.rb
Instance Attribute Summary collapse
-
#uri ⇒ Object
Returns the value of attribute uri.
Attributes inherited from Abstract
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(id, uri, path = self.class.file_path) ⇒ Bridge
constructor
A new instance of Bridge.
- #write(overwrite_existing_key = true) ⇒ Object
Methods inherited from Abstract
Constructor Details
#initialize(id, uri, path = self.class.file_path) ⇒ Bridge
23 24 25 26 |
# File 'lib/hue/config/bridge.rb', line 23 def initialize(id, uri, path = self.class.file_path) super(id, path) @uri = uri end |
Instance Attribute Details
#uri ⇒ Object
Returns the value of attribute uri.
21 22 23 |
# File 'lib/hue/config/bridge.rb', line 21 def uri @uri end |
Class Method Details
.file_path ⇒ Object
5 6 7 |
# File 'lib/hue/config/bridge.rb', line 5 def self.file_path File.join(ENV['HOME'], ".#{Hue.device_type}", 'bridges.yml') end |
.find(id) ⇒ Object
9 10 11 12 13 14 15 16 17 |
# File 'lib/hue/config/bridge.rb', line 9 def self.find(id) yaml = read_file(file_path) entry = yaml.select { |k,v| k.to_s == id.to_s } if entry.empty? nil else new(id, entry[id]['uri']) end end |
Instance Method Details
#id ⇒ Object
28 29 30 |
# File 'lib/hue/config/bridge.rb', line 28 def id self.name end |
#write(overwrite_existing_key = true) ⇒ Object
32 33 34 |
# File 'lib/hue/config/bridge.rb', line 32 def write(overwrite_existing_key = true) super(overwrite_existing_key) end |