Sha256: 8a62b992e0dd9397b38c7a74713cf7507a14b9876e6c956f0627ad4522b5f702

Contents?: true

Size: 547 Bytes

Versions: 1

Compression:

Stored size: 547 Bytes

Contents

module Booky::Textile
  class Load
    include Booky::Textile::Precompiler
    
    # Does the current line need to be precompiled?
    def matches line
      return false unless line.match /^load./
      line.gsub("load.", "").strip
    end
    
    # Replace the path with the contents of the file
    def compile_to options
      begin
        File.open("#{File.dirname(Booky.source)}/#{options}", 'rb') { |f| f.read }
      rescue
        raise Booky::LoadError.new "#{File.dirname(Booky.source)}/#{options}"
      end
    end
    
  end  
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
booky-0.0.4 lib/booky/textile/load.rb