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, #ext, #meta_info, #parent_path, #passive, #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
#<=>, #==, #acn, #alcn, #cn, #cnbase, #cnbase=, #dup, #hash, #inspect, #io, lcn, #lcn, make_absolute, match, #mount_at, #passive?, #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) {|mode| File.open(fs_path, mode) } @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 |