Sha256: 9f097d0a70d650d8561c277ef398d3d559f647ccfe8b416f329171b94794a0e1

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

module Vedeu

  module Templating

    # Converts a directive found in a template into a Vedeu::Stream object.
    class Directive

      include Vedeu::Templating::Helpers

      # @param code [String]
      # @return [Vedeu::Stream]
      def self.process(code)
        new(code).process
      end

      # @param code [String]
      def initialize(code)
        @code = code
      end

      # @return [Vedeu::Stream]
      def process
        eval(code, proc.binding)
      end

      protected

      # @!attribute [r] code
      # @return [String]
      attr_reader :code

      private

      # @return [Proc]
      def proc
        @proc ||= Proc.new {}
      end

    end # Directive

  end # Templating

end # Vedeu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
vedeu-0.4.32 lib/vedeu/templating/directive.rb
vedeu-0.4.31 lib/vedeu/templating/directive.rb
vedeu-0.4.30 lib/vedeu/templating/directive.rb
vedeu-0.4.29 lib/vedeu/templating/directive.rb
vedeu-0.4.28 lib/vedeu/templating/directive.rb