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.
418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 |
# File 'lib/ruby-macrodroid/actions.rb', line 418 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
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 |
# File 'lib/ruby-macrodroid/actions.rb', line 450 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 |