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.



5127
5128
5129
5130
5131
5132
5133
5134
5135
5136
5137
5138
# File 'lib/ruby-macrodroid.rb', line 5127

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



5140
5141
5142
5143
# File 'lib/ruby-macrodroid.rb', line 5140

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