Sha256: 34848525b1d65e55c0b4effa70df5be9edc3d37eeb595784d4ee853dcf4225fe

Contents?: true

Size: 790 Bytes

Versions: 3

Compression:

Stored size: 790 Bytes

Contents

require 'awestruct/renderable'

module Awestruct
  class RenderableFile < Renderable

    def initialize(site, source_path, relative_source_path)
      super( site )
      self.source_path          = source_path
      self.relative_source_path = relative_source_path
      dir_name = File.dirname( relative_source_path )
      if ( dir_name == '.' )
        self.output_path          = output_filename
      else
        self.output_path          = File.join( dir_name, output_filename )
      end
    end

    def raw_page_content
      File.read( self.source_path )
    end

    def render(context)
      raw_page_content
    end

    def output_extension
      File.extname( self.source_path )
    end

    def output_filename
      File.basename( self.source_path )
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
awestruct-0.0.3 lib/awestruct/renderable_file.rb
awestruct-0.0.2 lib/awestruct/renderable_file.rb
awestruct-0.0.1 lib/awestruct/renderable_file.rb