Sha256: 1f6e33f56e569df8f6490ba2e0318fcefabab9ba8ac547d7f21c3a88d2033dff

Contents?: true

Size: 855 Bytes

Versions: 14

Compression:

Stored size: 855 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
      unless ( relative_source_path.nil? )
        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
    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

14 entries across 14 versions & 1 rubygems

Version Path
awestruct-0.1.8 lib/awestruct/renderable_file.rb
awestruct-0.1.7 lib/awestruct/renderable_file.rb
awestruct-0.1.6 lib/awestruct/renderable_file.rb
awestruct-0.1.5 lib/awestruct/renderable_file.rb
awestruct-0.1.4 lib/awestruct/renderable_file.rb
awestruct-0.1.3 lib/awestruct/renderable_file.rb
awestruct-0.1.2 lib/awestruct/renderable_file.rb
awestruct-0.1.1 lib/awestruct/renderable_file.rb
awestruct-0.1.0 lib/awestruct/renderable_file.rb
awestruct-0.0.9 lib/awestruct/renderable_file.rb
awestruct-0.0.8 lib/awestruct/renderable_file.rb
awestruct-0.0.6 lib/awestruct/renderable_file.rb
awestruct-0.0.5 lib/awestruct/renderable_file.rb
awestruct-0.0.4 lib/awestruct/renderable_file.rb