Sha256: 41acc4aab66a433a7a1d79d3a3a9346ae3cf8a9031a1ba5de713f6eb34eab471

Contents?: true

Size: 505 Bytes

Versions: 9

Compression:

Stored size: 505 Bytes

Contents

module Sourcify
  module Proc
    module Scanner #:nodoc:all
      class Heredoc < Struct.new(:tag, :indented)

        def <<(content)
          (@contents ||= []) << content
        end

        def to_s
          @contents.join
        end

        def closed?(sealer)
          return false unless sealer == "\n"
          parts = @contents[-1].split("\n")
          return true if parts[-1] == tag
          indented && parts[-1].sub(/^\s*(.*)$/,'\1') == tag
        end

      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sourcify-0.5.0 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.4.2 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.4.1 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.4.0 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.3.0 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.2.3 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.2.2.1 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.2.1 lib/sourcify/proc/scanner/heredoc.rb
sourcify-0.2.0 lib/sourcify/proc/scanner/heredoc.rb