Sha256: e4b2d1130d3779e9475509e57add50ab85576a3306c272cf55fedfcbdd004eca

Contents?: true

Size: 911 Bytes

Versions: 12

Compression:

Stored size: 911 Bytes

Contents

require 'awestruct/renderable'

module Awestruct
  class RenderableFile < Renderable

    def initialize(site, source_path, relative_source_path, options = {})
      super( site )
      self.source_path          = source_path
      self.relative_source_path = relative_source_path
      self.options              = options
      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

12 entries across 12 versions & 1 rubygems

Version Path
awestruct-0.2.11 lib/awestruct/renderable_file.rb
awestruct-0.2.10 lib/awestruct/renderable_file.rb
awestruct-0.2.9 lib/awestruct/renderable_file.rb
awestruct-0.2.8 lib/awestruct/renderable_file.rb
awestruct-0.2.7 lib/awestruct/renderable_file.rb
awestruct-0.2.6 lib/awestruct/renderable_file.rb
awestruct-0.2.5 lib/awestruct/renderable_file.rb
awestruct-0.2.4 lib/awestruct/renderable_file.rb
awestruct-0.2.3 lib/awestruct/renderable_file.rb
awestruct-0.2.2 lib/awestruct/renderable_file.rb
awestruct-0.2.1 lib/awestruct/renderable_file.rb
awestruct-0.2.0 lib/awestruct/renderable_file.rb