Class: HMap::TargetVFSWriter

Inherits:
Object
  • Object
show all
Defined in:
lib/hmap/xc/target/target_vfs.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entrys) ⇒ TargetVFSWriter

Returns a new instance of TargetVFSWriter.



111
112
113
# File 'lib/hmap/xc/target/target_vfs.rb', line 111

def initialize(entrys)
  @entrys = entrys
end

Instance Attribute Details

#entrysObject (readonly)

Returns the value of attribute entrys.



109
110
111
# File 'lib/hmap/xc/target/target_vfs.rb', line 109

def entrys
  @entrys
end

Instance Method Details

#write!(path) ⇒ Object



115
116
117
118
119
120
121
122
123
# File 'lib/hmap/xc/target/target_vfs.rb', line 115

def write!(path)
  es = @entrys.map do |entry|
    VFS::FileCollectorEntry.new(entry.real_path, entry.virtual_path)
  end.uniq
  fc = VFS::FileCollector.new(es)
  pa = Pathname.new(path)
  pa.dirname.mkpath unless pa.exist?
  fc.write_mapping(pa)
end