Sha256: ea978103d6cf59f6caf60c59dc83d5104ce9cfc6dd33053d57b990790c776b78

Contents?: true

Size: 430 Bytes

Versions: 1

Compression:

Stored size: 430 Bytes

Contents

#!ruby

require_relative "../invfs"

module InVFS
  class StringMapFS
    attr_reader :map

    def initialize(*map)
      @map = Hash[*map]
    end

    def to_path
      sprintf %(#<%s 0x%08x>) % [self.class, object_id]
    end

    def file?(path)
      !!map.has_key?(path)
    end

    def size(path)
      (map[path] or return nil).bytesize
    end

    def read(path)
      (map[path] or return nil).to_s
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
invfs-0.3.1 lib/invfs/stringmapfs.rb