Sha256: 75917b2416b5066138d53a01a5628a5fddfc28e7ab3389dfb9bbc418d37b89d7

Contents?: true

Size: 934 Bytes

Versions: 3

Compression:

Stored size: 934 Bytes

Contents

require 'vedeu/api/base'
require 'vedeu/api/stream'

module Vedeu
  module API
    class Line < Base
      def build
        attributes
      end

      def stream(&block)
        attributes[:streams] << API::Stream.build(&block)
      end

      def text(value)
        attributes[:streams] << { text: value }
      end

      def foreground(value = '', &block)
        attributes[:streams] << API::Stream.build({
                                  colour: { foreground: value }
                                }, &block)
      end

      def background(value = '', &block)
        attributes[:streams] << API::Stream.build({
                                  colour: { background: value }
                                }, &block)
      end

      def attributes
        @_attributes ||= { colour:  {},
                           style:   [],
                           streams: [] }.merge!(@attributes)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
vedeu-0.1.9 lib/vedeu/api/line.rb
vedeu-0.1.8 lib/vedeu/api/line.rb
vedeu-0.1.7 lib/vedeu/api/line.rb