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
Instance Method Summary collapse
-
#changed? ⇒ Boolean
Return
trueif the file system path used by the object has been modified. -
#initialize(path, fs_path) ⇒ Path
constructor
Create a new object with absolute path
pathfor the file system pathfs_path.
Methods inherited from Path
#<=>, #==, #=~, #cn, #dup, #hash, #inspect, #io, #lcn, lcn, #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.
14 15 16 17 18 19 |
# File 'lib/webgen/source/filesystem.rb', line 14 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.
22 23 24 25 |
# File 'lib/webgen/source/filesystem.rb', line 22 def changed? data = WebsiteAccess.website.cache[[:fs_path, @fs_path]] File.mtime(@fs_path) > data end |