Sha256: 6a08d2c5b078c323689ea50ce87304ee7b9ee9dd0cba41b757de561e880817ee

Contents?: true

Size: 905 Bytes

Versions: 12

Compression:

Stored size: 905 Bytes

Contents

module Vedeu

  module Templating

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

      include Vedeu::Templating::Helpers

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

      # Returns a new instance of Vedeu::Templating::Directive.
      #
      # @param code [String]
      # @return [Vedeu::Templating::Directive]
      def initialize(code)
        @code = code
      end

      # Evaluate the code/text in the template; converting any recognised
      # directives as they are encountered.
      #
      # @return [Vedeu::Stream]
      def process
        eval(code, proc {}.binding)
      end

      protected

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

    end # Directive

  end # Templating

end # Vedeu

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
vedeu-0.4.56 lib/vedeu/templating/directive.rb
vedeu-0.4.55 lib/vedeu/templating/directive.rb
vedeu-0.4.54 lib/vedeu/templating/directive.rb
vedeu-0.4.53 lib/vedeu/templating/directive.rb
vedeu-0.4.52 lib/vedeu/templating/directive.rb
vedeu-0.4.51 lib/vedeu/templating/directive.rb
vedeu-0.4.50 lib/vedeu/templating/directive.rb
vedeu-0.4.49 lib/vedeu/templating/directive.rb
vedeu-0.4.48 lib/vedeu/templating/directive.rb
vedeu-0.4.47 lib/vedeu/templating/directive.rb
vedeu-0.4.46 lib/vedeu/templating/directive.rb
vedeu-0.4.45 lib/vedeu/templating/directive.rb