Class: Webgen::Source::TarArchive::Path

Inherits:
Path
  • Object
show all
Defined in:
lib/webgen/source/tararchive.rb

Overview

A special Webgen::Path class for handling paths from a tar archive.

Instance Attribute Summary

Attributes inherited from Path

#basename, #ext, #meta_info, #parent_path, #passive, #path, #source_path

Instance Method Summary collapse

Methods inherited from Path

#<=>, #==, #acn, #alcn, #cn, #cnbase, #cnbase=, #dup, #hash, #inspect, #io, lcn, #lcn, make_absolute, match, #mount_at, #passive?, #to_s

Constructor Details

#initialize(path, data, mtime, uri) ⇒ Path

Create a new tar archive path object for the entry entry.



26
27
28
29
30
31
32
# File 'lib/webgen/source/tararchive.rb', line 26

def initialize(path, data, mtime, uri)
  super(path) {|mode| StringIO.new(data.to_s, mode) }
  @uri = uri
  @mtime = mtime
  WebsiteAccess.website.cache[[:tararchive_path, @uri, path]] = @mtime if WebsiteAccess.website
  @meta_info['modified_at'] = @mtime
end

Instance Method Details

#changed?Boolean

Return true if the tar archive path used by the object has been modified.

Returns:

  • (Boolean)


35
36
37
# File 'lib/webgen/source/tararchive.rb', line 35

def changed?
  !WebsiteAccess.website || @mtime > WebsiteAccess.website.cache[[:tararchive_path, @uri, path]]
end