Class: TimeOfDayConstraint

Inherits:
Constraint show all
Defined in:
lib/ruby-macrodroid.rb

Overview

Category: Date/Time

Instance Attribute Summary

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Constraint

#match?

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ TimeOfDayConstraint

Returns a new instance of TimeOfDayConstraint.



5141
5142
5143
5144
5145
5146
5147
5148
5149
5150
5151
5152
# File 'lib/ruby-macrodroid.rb', line 5141

def initialize(h={})

  options = {
    end_hour: 8,
    end_minute: 0,
    start_hour: 22,
    start_minute: 0
  }

  super(options.merge h)

end

Instance Method Details

#to_s(colour: false) ⇒ Object Also known as: to_summary



5154
5155
5156
5157
# File 'lib/ruby-macrodroid.rb', line 5154

def to_s(colour: false)
  a = @h[:start_hour], @h[:start_minute], @h[:end_hour], @h[:start_minute]
  'Time of Day ' + "%02d:%02d - %02d:%02d" % a    
end