Sha256: 5afc95f64c66b36362e4017820348fbd2489d3b71526c07f30bab2385071bda7
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'awestruct/handlers/base_handler' module Awestruct module Handlers class FileHandler < BaseHandler attr_accessor :path def initialize(site, path) super( site ) case ( path ) when Pathname @path = path else @path = Pathname.new( path.to_s ) end end def output_filename File.basename( @path ) end def relative_source_path begin p = path.relative_path_from( site.dir ) return nil if !! ( %r(^\.\.) =~ p ) File.join( '', p ) rescue nil end end def stale? return true if ( @content.nil? || ( File.mtime( @path ) > @mtime ) ) false end def input_mtime(page) path.mtime end def raw_content read @content end def rendered_content(context, with_layouts=true) raw_content end private def read ( @content = File.read( @path ) ) if stale? @mtime = File.mtime( @path ) return @content end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
awestructx-0.4.0 | lib/awestruct/handlers/file_handler.rb |