Class: SafeDb::Remove

Inherits:
EditVerse show all
Defined in:
lib/controller/edit/remove.rb

Overview

The remove use case takes away one or more of the safe’s core entities.

  • at verse level - it can delete one or more lines

  • at chapter level - it can delete one or more verses

  • at book level - it can delete one or more chapters

  • at safe level - it can delete one book

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from EditVerse

#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_id=(value) ⇒ Object (writeonly)

Sets the attribute line_id

Parameters:

  • value

    the value to set the attribute line_id to.



14
15
16
# File 'lib/controller/edit/remove.rb', line 14

def line_id=(value)
  @line_id = value
end

Instance Method Details

#edit_verseObject

Deletion that currently expects an open chapter and verse and always wants to delete only one line (key/value pair).



18
19
20
21
22
23
24
25
26
# File 'lib/controller/edit/remove.rb', line 18

def edit_verse()

  # @todo refactor to recognise file values using isMap rather than the string prefix
  # @todo refactor the Rename, Show, Read and Write use cases as well as this one.

  @verse.delete( @line_id )
  @verse.delete( "#{Indices::INGESTED_FILE_LINE_NAME_KEY}#{@line_id}" )

end