Module: PathMapper::Node::Null::File
- Defined in:
- lib/path_mapper/node/null/file.rb
Instance Method Summary collapse
- #_append_line!(line) ⇒ Object
- #_create! ⇒ Object
- #_delete!(full: false) ⇒ Object
- #_put!(content) ⇒ Object
- #_remove!(content) ⇒ Object
- #_rename!(new_path) ⇒ Object
- #_safe_put!(content) ⇒ Object
- #md5 ⇒ Object
Instance Method Details
#_append_line!(line) ⇒ Object
24 25 26 |
# File 'lib/path_mapper/node/null/file.rb', line 24 def _append_line!(line) { d: { result: self.put!(line, logger: false), diff: self.custom_diff(nil, with_line_separator(line)) }, code: :created } end |
#_create! ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/path_mapper/node/null/file.rb', line 5 def _create! self.with_dry_run do |dry_run| if dry_run self.storage_tree(@path) else @path.mkpath end end { d: { result: self._create_node(@path) }, code: :created } end |
#_delete!(full: false) ⇒ Object
28 29 30 |
# File 'lib/path_mapper/node/null/file.rb', line 28 def _delete!(full: false) { d: { result: self }, code: :ok } end |
#_put!(content) ⇒ Object
16 17 18 |
# File 'lib/path_mapper/node/null/file.rb', line 16 def _put!(content) { d: { result: self._file_puts(content), diff: self.custom_diff(nil, with_line_separator(content)) }, code: :created } end |
#_remove!(content) ⇒ Object
32 33 34 |
# File 'lib/path_mapper/node/null/file.rb', line 32 def _remove!(content) { d: { result: self }, code: :ok } end |
#_rename!(new_path) ⇒ Object
36 37 38 |
# File 'lib/path_mapper/node/null/file.rb', line 36 def _rename!(new_path) { d: { result: self._create_node(new_path) }, code: :ok } end |
#_safe_put!(content) ⇒ Object
20 21 22 |
# File 'lib/path_mapper/node/null/file.rb', line 20 def _safe_put!(content) { d: { result: self.put!(content, logger: false), diff: self.custom_diff(nil, with_line_separator(content)) }, code: :created } end |
#md5 ⇒ Object
40 41 42 |
# File 'lib/path_mapper/node/null/file.rb', line 40 def md5 nil end |