Sha256: ffd99829d3b944746dcdfd98c829fefed0bd1e70c7452a43ae545d0f1654a706

Contents?: true

Size: 403 Bytes

Versions: 3

Compression:

Stored size: 403 Bytes

Contents

module Vedeu
  class TextAdaptor
    def self.adapt(text)
      new(text).adapt
    end

    def initialize(text)
      @text = text
    end

    def adapt
      return [] if no_content?

      lines.map { |line| { streams: { text: line } } }
    end

    private

    attr_reader :text

    def lines
      text.split(/\n/)
    end

    def no_content?
      text.nil? || text.empty?
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.0.37 lib/vedeu/parsing/text_adaptor.rb
vedeu-0.0.36 lib/vedeu/output/text_adaptor.rb
vedeu-0.0.35 lib/vedeu/output/text_adaptor.rb