Class: TextManipulationAction

Inherits:
Action show all
Defined in:
lib/ruby-macrodroid/actions.rb

Overview

MacroDroid Specific

Instance Attribute Summary

Attributes inherited from Action

#constraints

Attributes inherited from MacroObject

#options, #siguid, #type

Instance Method Summary collapse

Methods inherited from Action

#invoke

Methods included from ObjectX

#action_to_object, #object_create, #varify

Methods inherited from MacroObject

#to_h

Constructor Details

#initialize(h = {}) ⇒ TextManipulationAction

Returns a new instance of TextManipulationAction.



1883
1884
1885
1886
1887
1888
1889
1890
# File 'lib/ruby-macrodroid/actions.rb', line 1883

def initialize(h={})
  
  options = {

  }
  super(h)
  
end

Instance Method Details

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



1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
# File 'lib/ruby-macrodroid/actions.rb', line 1892

def to_s(colour: false, indent: 0)
  
  #tm = @h[:text_manipulation][:type]

  #s = case tm[:type].to_sym
  s = case 3 # @h[:text_manipulation][:option].to_i
  when 0 # :SubstringManipulation
    "Substring(%s, %s)" % [@h[:text], tm[:params].join(', ')]
  when 1 # :ReplaceAllManipulation
    "Replace all(%s, %s, %s)" % [@h[:text], *tm[:params]]      
  when 2 # :ExtractTextManipulation
    "Extract text(%s, %s)" % [@h[:text], tm[:params].join(', ')]      
  when 3 # :UpperCaseManipulation
    "Upper case(%s)" % [@h[:text]]
    #'foo'
  when 4 # :LowerCaseManipulation
    "Lower case(%s)" % [@h[:text]]      
  when 5 # :TrimWhitespaceManipulation
    "Trim whitespace(%s)" % [@h[:text]]      
  end

  'Text Manipulation' + "\n  " + s.inspect #+ ' ' + @h.inspect        
  
end