Sha256: 4762120f8b62594b03bb71980d0d793b2867de3aa06138f129311e67f6c18baf
Contents?: true
Size: 698 Bytes
Versions: 1
Compression:
Stored size: 698 Bytes
Contents
require 'oj' require 'virtus' require_relative '../support/esc' module Vedeu class Colour include Virtus.model attribute :foreground, String attribute :background, String def foreground @fg ||= Esc.foreground_colour(css_foreground) end def background @bg ||= Esc.background_colour(css_background) end def css_foreground @foreground || '' end def css_background @background || '' end def to_json Oj.dump(as_hash, mode: :compat) end def to_s foreground + background end def as_hash { foreground: css_foreground, background: css_background, } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.32 | lib/vedeu/models/colour.rb |