Class: FileOperationV21Action

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

Overview

Category: Files

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 = {}) ⇒ FileOperationV21Action

Returns a new instance of FileOperationV21Action.



1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
# File 'lib/ruby-macrodroid/actions.rb', line 1581

def initialize(h={})

  options = {
    :app_name=>"", :class_name=>"", :package_name=>"", :file_path=>"", 
    :file_extensions=>["jpg", "jpeg", "png", "raw", "bmp", "tif", "tiff", 
                       "gif"], :file_option=>2, :from_name=>"Sent", 
    :from_uri_string=>"", :option=>2
  }

  super(options.merge h)

end

Instance Method Details

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



1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
# File 'lib/ruby-macrodroid/actions.rb', line 1594

def to_s(colour: false, indent: 0)
  
  operation = ['Copy', 'Move', 'Delete', 'Create Folder']
  file = ['All Files', 'All Media Files', 'Images', 'Audio', 'Videos', 'Specify File Pattern', 'Folder']
  
  detail = @h[:from_name]
  detail += ' to: ' + @h[:to_name] if @h[:option] == 1
  @s = "%s %s" % [operation[@h[:option]], file[@h[:file_option]]]  \
      + "\n" + detail #+ @h.inspect        
  super()
end