Class: InVFS::StringMapFS
Instance Attribute Summary collapse
-
#map ⇒ Object
readonly
Returns the value of attribute map.
Instance Method Summary collapse
- #file?(path) ⇒ Boolean
-
#initialize(*map) ⇒ StringMapFS
constructor
A new instance of StringMapFS.
- #read(path) ⇒ Object
- #size(path) ⇒ Object
- #to_path ⇒ Object
Constructor Details
#initialize(*map) ⇒ StringMapFS
Returns a new instance of StringMapFS.
9 10 11 |
# File 'lib/invfs/stringmapfs.rb', line 9 def initialize(*map) @map = Hash[*map] end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
7 8 9 |
# File 'lib/invfs/stringmapfs.rb', line 7 def map @map end |
Instance Method Details
#file?(path) ⇒ Boolean
17 18 19 |
# File 'lib/invfs/stringmapfs.rb', line 17 def file?(path) !!map.has_key?(path) end |
#read(path) ⇒ Object
25 26 27 |
# File 'lib/invfs/stringmapfs.rb', line 25 def read(path) (map[path] or return nil).to_s end |
#size(path) ⇒ Object
21 22 23 |
# File 'lib/invfs/stringmapfs.rb', line 21 def size(path) (map[path] or return nil).bytesize end |
#to_path ⇒ Object
13 14 15 |
# File 'lib/invfs/stringmapfs.rb', line 13 def to_path sprintf %(#<%s 0x%08x>) % [self.class, object_id] end |