Class: SafeDb::Copy

Inherits:
QueryVerse show all
Defined in:
lib/controller/query/copy.rb

Overview

The copy use case copies one or more chapters, one or more verses and one or more lines to the clipboard so Ctrl-v can be used outside the safe to paste data in (like complex passwords).

Use Drag and Drop to move data between books, chapters, verses and lines.

Visit documentation at www.safedb.net/docs/copy-paste

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from QueryVerse

#execute

Methods inherited from Controller

#check_post_conditions, #check_pre_conditions, #execute, #flow, #initialize, #open_remote_backend_location, #post_validation, #pre_validation, #read_verse, #set_verse, #update_verse

Constructor Details

This class inherits a constructor from SafeDb::Controller

Instance Attribute Details

#line=(value) ⇒ Object (writeonly)

this entity can point to a book, chapter, verse or line. If no parameter entity is provided, the –all switch must be present to avoid an error message.



18
19
20
# File 'lib/controller/query/copy.rb', line 18

def line=(value)
  @line = value
end

Instance Method Details

#cannot_copy_lineObject



51
52
53
54
55
56
57
58
# File 'lib/controller/query/copy.rb', line 51

def cannot_copy_line()

  puts ""
  puts "No parameter line to copy was given."
  puts "Also this verse does not have a @password line."
  puts ""

end

#line_copiedObject



39
40
41
42
43
44
45
46
47
48
# File 'lib/controller/query/copy.rb', line 39

def line_copied()

  puts ""
  puts "The value for line \"#{@line}\" has been copied to the clipboard."
  puts "You can use either Ctrl-v or a mouse middle click to paste it."
  puts ""
  puts "Wipe it from the clipboard with $ safe wipe"
  puts ""

end

#query_verseObject

The copy use case copies one or more chapters, one or more verses and one or more lines to the clipboard so Ctrl-v can be used outside the safe to paste data in (like complex passwords).



23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/controller/query/copy.rb', line 23

def query_verse()

  @line = "@password" if @line.nil?
  unless ( @verse.has_key?( @line ) )
    cannot_copy_line()
    return
  end

  system "printf \"#{@verse[ @line ]}\" | xclip"
  system "printf \"#{@verse[ @line ]}\" | xclip -selection clipbaord"

  line_copied()

end