Class: MotionTrigger
- Inherits:
-
Object
- Object
- MotionTrigger
- Defined in:
- lib/macrohub.rb
Instance Attribute Summary collapse
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(location: nil) ⇒ MotionTrigger
constructor
A new instance of MotionTrigger.
- #match?(detail) ⇒ Boolean
- #to_node ⇒ Object
- #to_rowx ⇒ Object
Constructor Details
#initialize(location: nil) ⇒ MotionTrigger
Returns a new instance of MotionTrigger.
73 74 75 76 77 78 |
# File 'lib/macrohub.rb', line 73 def initialize(location: nil) @location = location @type = :motion end |
Instance Attribute Details
#location ⇒ Object (readonly)
Returns the value of attribute location.
71 72 73 |
# File 'lib/macrohub.rb', line 71 def location @location end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
71 72 73 |
# File 'lib/macrohub.rb', line 71 def type @type end |
Instance Method Details
#match?(detail) ⇒ Boolean
80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/macrohub.rb', line 80 def match?(detail) puts 'inside MotionTrigger#match' if $debug location = detail[:location] if location then @location.downcase == location.downcase else return false end end |
#to_node ⇒ Object
95 96 97 98 |
# File 'lib/macrohub.rb', line 95 def to_node() Rexle::Element.new(:trigger, attributes: {type: :motion, location: @location}) end |
#to_rowx ⇒ Object
100 101 102 |
# File 'lib/macrohub.rb', line 100 def to_rowx() "trigger: Motion detected in the %s" % @location end |