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
Returns a new instance of SpeakTextAction.
942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 |
# File 'lib/ruby-macrodroid/actions.rb', line 942 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
967 968 969 |
# File 'lib/ruby-macrodroid/actions.rb', line 967 def invoke() super(text: @h[:text_to_say]) end |
#to_s(colour: false, indent: 0) ⇒ Object
971 972 973 974 |
# File 'lib/ruby-macrodroid/actions.rb', line 971 def to_s(colour: false, indent: 0) @s = "Speak Text (%s)" % @h[:text_to_say] super() end |