Class: TextManipulationAction

Inherits:
MacroDroidAction 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.



2020
2021
2022
2023
2024
2025
2026
2027
# File 'lib/ruby-macrodroid/actions.rb', line 2020

def initialize(h={})
  
  options = {

  }
  super(h)
  
end

Instance Method Details

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



2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
# File 'lib/ruby-macrodroid/actions.rb', line 2029

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