Class: VFS::JSONWriter Abstract
- Inherits:
-
Object
- Object
- VFS::JSONWriter
- Defined in:
- lib/yaml-vfs/yaml_vfs.rb
Overview
This class is abstract.
JSONWriter class.
Instance Attribute Summary collapse
-
#dir_stack ⇒ Object
readonly
Returns the value of attribute dir_stack.
Instance Method Summary collapse
-
#initialize ⇒ JSONWriter
constructor
A new instance of JSONWriter.
- #write(entries, use_external_names, case_sensitive, overlay_relative, overlay_dir) ⇒ Object
Constructor Details
#initialize ⇒ JSONWriter
Returns a new instance of JSONWriter.
79 80 81 |
# File 'lib/yaml-vfs/yaml_vfs.rb', line 79 def initialize @dir_stack = [] end |
Instance Attribute Details
#dir_stack ⇒ Object (readonly)
Returns the value of attribute dir_stack.
65 66 67 |
# File 'lib/yaml-vfs/yaml_vfs.rb', line 65 def dir_stack @dir_stack end |
Instance Method Details
#write(entries, use_external_names, case_sensitive, overlay_relative, overlay_dir) ⇒ Object
67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/yaml-vfs/yaml_vfs.rb', line 67 def write(entries, use_external_names, case_sensitive, , ) = write_yaml_header(use_external_names, case_sensitive, , ) unless entries.empty? current_dir_empty = write_root_entry(entries, , ) entries.drop(1).reduce(current_dir_empty) do |empty, entry| dir = entry.directory? ? entry.v_path : entry.v_path.dirname start_directory_or_return(dir, empty, , , entry) end end (entries) end |