Class: VFS::FileCollector

Inherits:
Object
  • Object
show all
Defined in:
lib/yaml-vfs/file_collector.rb

Overview

vfs gen

Instance Method Summary collapse

Constructor Details

#initialize(entrys) ⇒ FileCollector

Returns a new instance of FileCollector.



86
87
88
89
# File 'lib/yaml-vfs/file_collector.rb', line 86

def initialize(entrys)
  @entrys = entrys || []
  @vfs_writer = YAMLVFSWriter.new
end

Instance Method Details

#write_mapping(name) ⇒ Object



91
92
93
94
95
96
97
98
99
100
101
# File 'lib/yaml-vfs/file_collector.rb', line 91

def write_mapping(name)
  add_write_file
  @vfs_writer.case_sensitive = false
  path = Pathname(name).expand_path
  unless VFS_FILES_EXTENSIONS.include?(File.extname(path))
    path.mkpath unless path.exist?
    path = path.join('all-product-headers.yaml')
  end
  stream = @vfs_writer.write
  File.open(path, 'w') { |f| f.write(stream) }
end