Sha256: e70ff1c92ea53eeba6f882d48947e132de965fda350638f0d30d1a8eb4d381e4

Contents?: true

Size: 1008 Bytes

Versions: 1

Compression:

Stored size: 1008 Bytes

Contents

module Quarry

  class Markup #:nodoc:

    # = Comment
    #
    class Comment

      attr :spec
      attr :text
      attr :lineno

      def initialize(spec, text, lineno)
        @spec   = spec
        @text   = text.strip
        @lineno = lineno
      end

      alias_method :parent, :spec
      alias_method :description, :text

      # Matches the beginning of text to
      # determine if this defines a macro section.
      def type
        /\A(\w{1,9})[:]\ /i =~ text
        $1.downcase.to_sym if $1
      end
      alias_method :macro?, :type

      # "run" comment.
      def run(runner, spec, context, output)
        output.report_comment(self)
      end

      #
      def to_s
        text.to_s
      end

      # As could appear in stand-alone script.
      def to_script
        text.to_s.gsub(/^/m, '# ')
      end

    end #class Comment

  end #class Markup

end #module Quarry


# TABLE: "mytable.yaml" This is what and so on.
# This is so it will be wahtever fi so.
#
#  fdsffsdf

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
quarry-0.5.2 lib/quarry/markup/comment.rb