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, #cnbase, #directory, #ext, #meta_info, #path, #source_path

Instance Method Summary collapse

Methods inherited from Path

#<=>, #==, #cn, #dup, #hash, #inspect, #io, #lcn, lcn, match, #mount_at, #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) { StringIO.new(data.to_s) }
  @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