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
- #child_handler_initialized(child_handler, child_thing) ⇒ Object
- #handle_command(channel, command) ⇒ Object
-
#initialize(thing = nil) ⇒ ThingHandler
constructor
A new instance of ThingHandler.
- #set_callback(callback) ⇒ Object
Constructor Details
#initialize(thing = nil) ⇒ ThingHandler
Returns a new instance of ThingHandler.
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 13 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.
11 12 13 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 11 def callback @callback end |
#thing ⇒ Object (readonly)
Returns the value of attribute thing.
11 12 13 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 11 def thing @thing end |
Instance Method Details
#child_handler_initialized(child_handler, child_thing) ⇒ Object
32 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 32 def child_handler_initialized(child_handler, child_thing); end |
#handle_command(channel, command) ⇒ Object
26 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 26 def handle_command(channel, command); end |
#set_callback(callback) ⇒ Object
28 29 30 |
# File 'lib/rspec/openhab/core/mocks/thing_handler.rb', line 28 def set_callback(callback) @callback = callback end |