Class: RSpec::OpenHAB::Core::Mocks::ThingHandler
- Inherits:
-
Object
- Object
- RSpec::OpenHAB::Core::Mocks::ThingHandler
- Defined in:
- lib/rspec/openhab/core/mocks/thing_handler.rb
Instance Attribute Summary collapse
-
#callback ⇒ Object
readonly
Returns the value of attribute callback.
-
#thing ⇒ Object
readonly
Returns the value of attribute thing.
Instance Method Summary collapse
- #channel_linked(_channel_uid) ⇒ Object
- #channel_unlinked(_channel_uid) ⇒ Object
- #child_handler_disposed(child_handler, child_thing) ⇒ Object
- #child_handler_initialized(child_handler, child_thing) ⇒ Object
- #dispose ⇒ Object
- #handle_command(channel, command) ⇒ Object
-
#initialize(thing = nil) ⇒ ThingHandler
constructor
A new instance of ThingHandler.
- #set_callback(callback) ⇒ Object
- #thing_updated(thing) ⇒ Object
Constructor Details
#initialize(thing = nil) ⇒ ThingHandler
Returns a new instance of ThingHandler.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 15 def initialize(thing = nil) # have to handle the interface method if thing.nil? status_info = org.openhab.core.thing.binding.builder.ThingStatusInfoBuilder .create(org.openhab.core.thing.ThingStatus::ONLINE).build @callback.status_updated(self.thing, status_info) return end # ruby initializer here @thing = thing end |
Instance Attribute Details
#callback ⇒ Object (readonly)
Returns the value of attribute callback.
13 14 15 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 13 def callback @callback end |
#thing ⇒ Object (readonly)
Returns the value of attribute thing.
13 14 15 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 13 def thing @thing end |
Instance Method Details
#channel_linked(_channel_uid) ⇒ Object
41 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 41 def channel_linked(_channel_uid); end |
#channel_unlinked(_channel_uid) ⇒ Object
42 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 42 def channel_unlinked(_channel_uid); end |
#child_handler_disposed(child_handler, child_thing) ⇒ Object
39 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 39 def child_handler_disposed(child_handler, child_thing); end |
#child_handler_initialized(child_handler, child_thing) ⇒ Object
38 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 38 def child_handler_initialized(child_handler, child_thing); end |
#dispose ⇒ Object
44 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 44 def dispose; end |
#handle_command(channel, command) ⇒ Object
32 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 32 def handle_command(channel, command); end |
#set_callback(callback) ⇒ Object
34 35 36 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 34 def set_callback(callback) @callback = callback end |
#thing_updated(thing) ⇒ Object
28 29 30 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 28 def thing_updated(thing) @thing = thing end |