Sha256: c4274de8aec01f76c930d85c1cd00faedee4f166950cda3b712415dda5950025
Contents?: true
Size: 792 Bytes
Versions: 6
Compression:
Stored size: 792 Bytes
Contents
# An in-memory file abstraction. Commonly used with Puppet::FileSystem::File#overlay # @api private class Puppet::FileSystem::MemoryFile attr_reader :path def self.a_missing_file(path) new(path, :exist? => false, :executable? => false) end def self.a_regular_file_containing(path, content) new(path, :exist? => true, :executable? => false, :content => content) end def self.an_executable(path) new(path, :exist? => true, :executable? => true) end def initialize(path, options) @path = Pathname.new(path) @exist = options[:exist?] @executable = options[:executable?] @content = options[:content] end def exist?; @exist; end def executable?; @executable; end def each_line(&block) StringIO.new(@content).each_line(&block) end end
Version data entries
6 entries across 6 versions & 1 rubygems