Sha256: e5c909bf94b6359c6462ecd4135569a51a35683aef44b24071983493ace165f6
Contents?: true
Size: 1.05 KB
Versions: 3
Compression:
Stored size: 1.05 KB
Contents
module Vedeu class InvalidDirective < StandardError; end class Directive class << self def enact(interface, directives = {}) new(interface, directives).enact end end def initialize(interface, directives = {}) @interface = interface @directives = directives || {} end def enact [set_position, set_colour, set_style, set_text].join end private attr_reader :interface, :directives def set_position Position.set(*position) end def set_colour Colour.set(colour) unless colour.empty? end def set_style Array(style).map { |s| Style.set(s) }.join end def set_text Wordwrap.this(text, options) end def position directives.fetch(:position, []) end def colour directives.fetch(:colour, []) end def style directives.fetch(:style, []) end def text directives.fetch(:text, '') end def options { width: interface.geometry.width, prune: true } end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.0.25 | lib/vedeu/output/directive.rb |
vedeu-0.0.24 | lib/vedeu/output/directive.rb |
vedeu-0.0.23 | lib/vedeu/output/directive.rb |