Sha256: 51edd83970a1d4201d725185c330abb6f6231389bfd74d06e854bf4ec8e9829c

Contents?: true

Size: 498 Bytes

Versions: 1

Compression:

Stored size: 498 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.as_hash,
        style:  style,
        text:   text
      }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.32 lib/vedeu/models/stream.rb