Sha256: 69978a398011115668ecd2b3e0309b19e45d4cb4236c08957e2a7859d4baf628

Contents?: true

Size: 557 Bytes

Versions: 3

Compression:

Stored size: 557 Bytes

Contents

module Lucid
  module AST
    class Comment #:nodoc:
      def initialize(value)
        @value = value
      end

      def empty?
        @value.nil? || @value == ""
      end

      def accept(visitor)
        return if Lucid.wants_to_quit
        return if empty?

        visitor.visit_comment(self) do
          @value.strip.split("\n").each do |line|
            visitor.visit_comment_line(line.strip)
          end
        end
      end

      def to_sexp
        (@value.nil? || @value == '') ? nil : [:comment, @value]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
lucid-0.0.9 lib/lucid/ast/comment.rb
lucid-0.0.8 lib/lucid/ast/comment.rb
lucid-0.0.7 lib/lucid/ast/comment.rb