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.
319 320 321 |
# File 'lib/invfs.rb', line 319 def initialize(*map) @map = Hash[*map] end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
317 318 319 |
# File 'lib/invfs.rb', line 317 def map @map end |
Instance Method Details
#file?(path) ⇒ Boolean
327 328 329 |
# File 'lib/invfs.rb', line 327 def file?(path) !!map.has_key?(path) end |
#read(path) ⇒ Object
335 336 337 |
# File 'lib/invfs.rb', line 335 def read(path) (map[path] or return nil).to_s end |
#size(path) ⇒ Object
331 332 333 |
# File 'lib/invfs.rb', line 331 def size(path) (map[path] or return nil).bytesize end |
#to_path ⇒ Object
323 324 325 |
# File 'lib/invfs.rb', line 323 def to_path sprintf %(#<%s 0x%08x>) % [self.class, object_id] end |