Class: Lockness::Edit
- Inherits:
-
Object
- Object
- Lockness::Edit
- Defined in:
- lib/lockness/edit.rb
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#encrypted_file ⇒ Object
readonly
Returns the value of attribute encrypted_file.
-
#temp_file ⇒ Object
readonly
Returns the value of attribute temp_file.
Instance Method Summary collapse
- #edit ⇒ Object
-
#initialize ⇒ Edit
constructor
A new instance of Edit.
Constructor Details
#initialize ⇒ Edit
Returns a new instance of Edit.
8 9 10 11 12 |
# File 'lib/lockness/edit.rb', line 8 def initialize @encrypted_file = EncryptedFile.new(path: PathBuilder.path) @content = Content.new(encrypted_file: encrypted_file) @temp_file = Tempfile.new end |
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
4 5 6 |
# File 'lib/lockness/edit.rb', line 4 def content @content end |
#encrypted_file ⇒ Object (readonly)
Returns the value of attribute encrypted_file.
4 5 6 |
# File 'lib/lockness/edit.rb', line 4 def encrypted_file @encrypted_file end |
#temp_file ⇒ Object (readonly)
Returns the value of attribute temp_file.
4 5 6 |
# File 'lib/lockness/edit.rb', line 4 def temp_file @temp_file end |
Instance Method Details
#edit ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/lockness/edit.rb', line 14 def edit ensure_temp_file_deleted if encrypted_file.exist? edit_existing else edit_new end puts "File saved: #{encrypted_file.encrypted_path}" end |