Class: Webgen::Source::FileSystem::Path
- Defined in:
- lib/webgen/source/filesystem.rb
Overview
A special Webgen::Path class for handling with file system paths.
Instance Attribute Summary
Attributes inherited from Path
#basename, #cnbase, #directory, #ext, #meta_info, #path, #source_path
Instance Method Summary collapse
-
#changed? ⇒ Boolean
Return
true
if the file system path used by the object has been modified. -
#initialize(path, fs_path) ⇒ Path
constructor
Create a new object with absolute path
path
for the file system pathfs_path
.
Methods inherited from Path
#<=>, #==, #cn, #dup, #hash, #inspect, #io, #lcn, lcn, match, #mount_at, #to_s
Constructor Details
#initialize(path, fs_path) ⇒ Path
Create a new object with absolute path path
for the file system path fs_path
.
16 17 18 19 20 21 |
# File 'lib/webgen/source/filesystem.rb', line 16 def initialize(path, fs_path) super(path) { File.open(fs_path, 'rb') } @fs_path = fs_path WebsiteAccess.website.cache[[:fs_path, @fs_path]] = File.mtime(@fs_path) @meta_info['modified_at'] = File.mtime(@fs_path) end |
Instance Method Details
#changed? ⇒ Boolean
Return true
if the file system path used by the object has been modified.
24 25 26 27 |
# File 'lib/webgen/source/filesystem.rb', line 24 def changed? data = WebsiteAccess.website.cache[[:fs_path, @fs_path]] File.mtime(@fs_path) > data end |