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.



1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
# File 'lib/ruby-macrodroid/actions.rb', line 1342

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



1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
# File 'lib/ruby-macrodroid/actions.rb', line 1355

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