Class: HeadphonesConnectionConstraint

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

Overview

Category: Media

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 = {}) ⇒ HeadphonesConnectionConstraint

Returns a new instance of HeadphonesConnectionConstraint.



978
979
980
981
982
983
984
985
986
# File 'lib/ruby-macrodroid/constraints.rb', line 978

def initialize(h={})

  options = {
    connected: true
  }

  super(options.merge h)

end

Instance Method Details

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



988
989
990
991
# File 'lib/ruby-macrodroid/constraints.rb', line 988

def to_s(colour: false, indent: 0)
  connection = @h[:connected] ? 'Connected' : 'Disconnected'
  'Headphones ' + connection
end