Sha256: f9bce3f4b88513b662718e469a0eab68528eb7adf57800446c27b81f28b85ed0

Contents?: true

Size: 490 Bytes

Versions: 2

Compression:

Stored size: 490 Bytes

Contents

require 'virtus'

require_relative 'presentation'
require_relative '../support/terminal'

module Vedeu
  class Stream
    include Virtus.model
    include Presentation

    attribute :text, String, default: ''

    def to_json
      Oj.dump(json_attributes, mode: :compat)
    end

    def to_s(options = {})
      [colour, style, text].join
    end

    private

    def json_attributes
      {
        colour: colour,
        style:  style,
        text:   text
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
vedeu-0.0.31 lib/vedeu/models/stream.rb
vedeu-0.0.30 lib/vedeu/models/stream.rb