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.



2118
2119
2120
2121
2122
2123
2124
2125
# File 'lib/ruby-macrodroid/actions.rb', line 2118

def initialize(h={})
  
  options = {

  }
  super(h)
  
end

Instance Method Details

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



2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
# File 'lib/ruby-macrodroid/actions.rb', line 2127

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