class SpeakTextAction

Category: Device Actions

Public Class Methods

new(obj=nil) click to toggle source
Calls superclass method DeviceAction::new
# File lib/ruby-macrodroid/actions.rb, line 1132
def initialize(obj=nil)
  
  h = if obj.is_a? Hash then
    obj
  elsif obj.is_a? Array
    e, macro = obj
    txt = e.text('item/description')
    {text: (txt || e.text)}
  end     

  options = {
    text_to_say: h[:text] || '',
    queue: false,
    read_numbers_individually: false,
    specify_audio_stream: false,
    speed: 0.99,
    pitch: 0.99,
    wait_to_finish: false,
    audio_stream: 0
  }

  super(options.merge h)

end

Public Instance Methods

invoke() click to toggle source
Calls superclass method Action#invoke
# File lib/ruby-macrodroid/actions.rb, line 1157
def invoke()
  super(text: @h[:text_to_say])
end
to_s(colour: false, indent: 0) click to toggle source
Calls superclass method MacroObject#to_s
# File lib/ruby-macrodroid/actions.rb, line 1161
def to_s(colour: false, indent: 0)
  @s = "Speak Text (%s)" % @h[:text_to_say]
  super()
end