Sha256: a1067fc616f4b04b83fab8ad53f53662dd7b75774a7c2f9f8ba43b23fe1ca24d

Contents?: true

Size: 918 Bytes

Versions: 3

Compression:

Stored size: 918 Bytes

Contents

module MasterView
  module Directives

    # Inserts a comment into the file that indicates that this file was generated
    # and should not be edited, else changes could be lost. It includes the path to
    # the original file that should be edited instead
    class Insert_generated_comment < MasterView::DirectiveBase

      Eval_comment_template = 'comment_text = "' + MasterView::GeneratedCommentText + '"'

      def priority
        DirectivePriorities::VeryLow
      end

      def stag(directive_call_stack)
        # do variable substitution to fill in any slots in the template
        template_path = attr_value
        #TBD: any other std name bindings we want to support?
        comment_text = ''
        eval(Eval_comment_template, binding)
        comment = "\n<%\n#{comment_text}\n-%>"

        ret = []
        ret << directive_call_stack.render
        ret << comment
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
masterview-0.2.0 lib/masterview/directives/insert_generated_comment.rb
masterview-0.2.1 lib/masterview/directives/insert_generated_comment.rb
masterview-0.2.2 lib/masterview/directives/insert_generated_comment.rb