Sha256: 0100ce28feb0e73145bb22fb5aeccdb270270721dcbf1c74b04055b332f2855a

Contents?: true

Size: 646 Bytes

Versions: 12

Compression:

Stored size: 646 Bytes

Contents

require 'awestruct/handlers/base_handler'

module Awestruct
  module Handlers
    class InterpolationHandler < BaseHandler

      def initialize(site, delegate)
        super( site, delegate )
      end

      def rendered_content(context, with_layouts=true)
        content = delegate.raw_content

        return nil if content.nil?
        return content unless site.interpolate

        content = content.gsub( /\\/, '\\\\\\\\' )
        content = content.gsub( /\\\\#/, '\\#' )
        content = content.gsub( '@', '\@' )
        content = "%@#{content}@"
        c = context.instance_eval( content )
        c

      end

    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
awestruct-0.4.5 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.4 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.3 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x10 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x9 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x8 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x7 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x6 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x5 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x4 lib/awestruct/handlers/interpolation_handler.rb
awestruct-0.4.2.x3 lib/awestruct/handlers/interpolation_handler.rb