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.



1843
1844
1845
1846
1847
1848
1849
1850
# File 'lib/ruby-macrodroid/actions.rb', line 1843

def initialize(h={})
  
  options = {

  }
  super(h)
  
end

Instance Method Details

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



1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
# File 'lib/ruby-macrodroid/actions.rb', line 1852

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