Sha256: 095a699ac59b1972bdee0256f596a1c35928a46f797ca543cb43518ea0fc634b

Contents?: true

Size: 881 Bytes

Versions: 1

Compression:

Stored size: 881 Bytes

Contents

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

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.1.10 lib/vedeu/api/line.rb