Class: ProjectSimulator::MotionTrigger

Inherits:
Object
  • Object
show all
Defined in:
lib/projectsimulator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(locationx, location: locationx) ⇒ MotionTrigger

Returns a new instance of MotionTrigger.



368
369
370
# File 'lib/projectsimulator.rb', line 368

def initialize(locationx, location: locationx)
  @location = location
end

Instance Attribute Details

#locationObject (readonly)

Returns the value of attribute location.



366
367
368
# File 'lib/projectsimulator.rb', line 366

def location
  @location
end

Instance Method Details

#matchObject



372
373
374
# File 'lib/projectsimulator.rb', line 372

def match()
  @location.downcase == location.downcase
end

#to_nodeObject



376
377
378
379
# File 'lib/projectsimulator.rb', line 376

def to_node()
  Rexle::Element.new(:trigger, \
                     attributes: {type: :motion, location: @location})
end

#to_rowxObject



381
382
383
# File 'lib/projectsimulator.rb', line 381

def to_rowx()
  "trigger: Motion detected in the %s" %  @location
end