Class: SetVariableAction
- Inherits:
-
Action
- Object
- MacroObject
- Action
- SetVariableAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Overview
MacroDroid Specific
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(h = {}) ⇒ SetVariableAction
constructor
A new instance of SetVariableAction.
- #to_s(colour: false) ⇒ Object (also: #to_summary)
Methods inherited from Action
Methods inherited from MacroObject
Constructor Details
#initialize(h = {}) ⇒ SetVariableAction
Returns a new instance of SetVariableAction.
1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 |
# File 'lib/ruby-macrodroid/actions.rb', line 1402 def initialize(h={}) = { :user_prompt=>true, :user_prompt_message=>"Please enter a word to see it reversed", :user_prompt_show_cancel=>true, :user_prompt_stop_after_cancel=>true, :user_prompt_title=>"Word reverse", :name => 'word' } super(h) end |
Instance Method Details
#to_s(colour: false) ⇒ Object Also known as: to_summary
1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452 |
# File 'lib/ruby-macrodroid/actions.rb', line 1416 def to_s(colour: false) input = if @h[:user_prompt] then '[User Prompt]' elsif @h[:expression] @h[:expression] elsif @h[:int_value_increment] '(+1)' elsif @h[:int_value_decrement] '(-1)' elsif @h[:int_random] "Random %d -> %d" % [@h[:int_random_min], @h[:int_random_max]] else =begin sym = case @h[:variable][:type] when 0 # boolean :new_boolean_value when 1 # integer :new_int_value when 2 # string :new_string_value when 3 # decimal :new_double_value end @h[sym].to_s =end a = %i(new_boolean_value new_int_value new_string_value new_double_value) @h[a[@h[:variable][:type]]].to_s end @s = 'Set Variable' + ("\n %s: " % @h[:variable][:name]) + input #+ @h.inspect super() end |