Sha256: 94eb456d4fe85e37fa1db1d73c20154e0c73480d68b661b3cf87db3d5330e354

Contents?: true

Size: 519 Bytes

Versions: 9

Compression:

Stored size: 519 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 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

9 entries across 9 versions & 1 rubygems

Version Path
lucid-0.5.1 lib/lucid/ast/comment.rb
lucid-0.4.1 lib/lucid/ast/comment.rb
lucid-0.4.0 lib/lucid/ast/comment.rb
lucid-0.3.3 lib/lucid/ast/comment.rb
lucid-0.3.0 lib/lucid/ast/comment.rb
lucid-0.2.1 lib/lucid/ast/comment.rb
lucid-0.2.0 lib/lucid/ast/comment.rb
lucid-0.1.1 lib/lucid/ast/comment.rb
lucid-0.1.0 lib/lucid/ast/comment.rb