Class: SpeakTextAction
- Inherits:
-
DeviceAction
- Object
- MacroObject
- Action
- DeviceAction
- SpeakTextAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
Category: Device Actions
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj = nil) ⇒ SpeakTextAction
constructor
A new instance of SpeakTextAction.
- #invoke ⇒ Object
- #to_s(colour: false, indent: 0) ⇒ Object
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(obj = nil) ⇒ SpeakTextAction
1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 |
# File 'lib/ruby-macrodroid/actions.rb', line 1038 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 = { 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(.merge h) end |
Instance Method Details
#invoke ⇒ Object
1063 1064 1065 |
# File 'lib/ruby-macrodroid/actions.rb', line 1063 def invoke() super(text: @h[:text_to_say]) end |
#to_s(colour: false, indent: 0) ⇒ Object
1067 1068 1069 1070 |
# File 'lib/ruby-macrodroid/actions.rb', line 1067 def to_s(colour: false, indent: 0) @s = "Speak Text (%s)" % @h[:text_to_say] super() end |