Sha256: cfaf921377e18f5b2a9463e70fdc300bc5a7411df81c53345e3eb028755ed595
Contents?: true
Size: 624 Bytes
Versions: 1
Compression:
Stored size: 624 Bytes
Contents
module Vedeu class Stream include Virtus.model attribute :colour, Colour, default: Colour.new attribute :style, Style, default: '' attribute :text, String, default: '' attribute :width, Integer attribute :align, Symbol, default: :left def to_s [ colour, style, data ].join end private def data width? ? aligned : text end def aligned case align when :right then text.rjust(width, ' ') when :centre then text.center(width, ' ') else text.ljust(width, ' ') end end def width? !!width end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.1.10 | lib/vedeu/models/stream.rb |