Sha256: 02ae3829116bf7e9cb01fb40dbd9e20ea025778a9a1103fd12bdfd1eb33ffc7b
Contents?: true
Size: 712 Bytes
Versions: 6
Compression:
Stored size: 712 Bytes
Contents
require 'json' require 'virtus' require 'vedeu/support/esc' module Vedeu class Colour include Virtus.model attribute :foreground, String, default: '' attribute :background, String, default: '' def foreground @fg ||= Esc.foreground_colour(css_foreground) end def background @bg ||= Esc.background_colour(css_background) end def to_json(*args) as_hash.to_json end def to_s foreground + background end private def as_hash { foreground: css_foreground, background: css_background, } end def css_foreground @foreground end def css_background @background end end end
Version data entries
6 entries across 6 versions & 1 rubygems