Class: TakeScreenshotAction
- Inherits:
-
CameraAction
- Object
- MacroObject
- Action
- CameraAction
- TakeScreenshotAction
- Defined in:
- lib/ruby-macrodroid/actions.rb
Instance Attribute Summary
Attributes inherited from Action
Attributes inherited from MacroObject
Instance Method Summary collapse
-
#initialize(obj = nil) ⇒ TakeScreenshotAction
constructor
A new instance of TakeScreenshotAction.
- #to_s(colour: false, indent: 0) ⇒ Object (also: #to_summary)
Methods inherited from Action
Methods included from ObjectX
#action_to_object, #object_create, #varify
Methods inherited from MacroObject
Constructor Details
#initialize(obj = nil) ⇒ TakeScreenshotAction
Returns a new instance of TakeScreenshotAction.
441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 |
# File 'lib/ruby-macrodroid/actions.rb', line 441 def initialize(obj=nil) h = if obj.is_a? Hash then obj elsif obj.is_a? Array e, macro = obj a = [ 'Save to device', 'Send via email', 'Share via intent' ] s = e.text('item/description').to_s index = a.map(&:downcase).index s.downcase {option: index} end = { option: 0, use_smtp_email: false, mechanism_option: 0, save_to_jpeg: false } super(.merge h) end |
Instance Method Details
#to_s(colour: false, indent: 0) ⇒ Object Also known as: to_summary
473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 |
# File 'lib/ruby-macrodroid/actions.rb', line 473 def to_s(colour: false, indent: 0) @s = 'Take Screenshot' #+ @h.inspect = [ 'Save to device', 'Send via email', 'Share via intent' ] option = [@h[:option]] @s += "\n" + option super() end |