Module: Vedeu::DSL::Presentation
- Included in:
- Borders::DSL, Line, Stream, View, Interfaces::DSL
- Defined in:
- lib/vedeu/dsl/presentation.rb
Overview
Provides colour and style helpers for use in the Interfaces::DSL, Line and Stream classes.
Instance Method Summary collapse
-
#background(value = '') ⇒ String
(also: #bg, #bgcolor, #background=, #bg=, #bgcolor=)
Define the background colour for an interface, line, or a stream.
-
#colour(attrs = {}) ⇒ Vedeu::Colours::Colour
(also: #colour=)
Define either or both foreground and background colours for an interface, line or a stream.
- #colour_attributes ⇒ Hash<Symbol => String> private
- #foreground(value = '') ⇒ Object (also: #fg, #fgcolor, #foreground=, #fg=, #fgcolor=)
-
#style(value) ⇒ Vedeu::Presentation::Style
(also: #style=, #styles, #styles=)
Define a style or styles for an interface, line or a stream.
Instance Method Details
#background(value = '') ⇒ String Also known as: bg, bgcolor, background=, bg=, bgcolor=
The last defined background colour for a particular interface, line or stream overrides previously defined entries in the same block.
Define the background colour for an interface, line, or a stream. When called with a block, will create a new stream with the background colour specified. When the block terminates, the background will return to that of the parent.
41 42 43 |
# File 'lib/vedeu/dsl/presentation.rb', line 41 def background(value = '') colour(background: Vedeu::Colours::Background.coerce(value)) end |
#colour(attrs = {}) ⇒ Vedeu::Colours::Colour Also known as: colour=
Rejects invalid keys and empty/nil attributes. Also, the last defined colour for a particular interface, line or stream overrides previously defined entries in the same block.
Define either or both foreground and background colours for an interface, line or a stream. At least one attribute is required.
88 89 90 91 |
# File 'lib/vedeu/dsl/presentation.rb', line 88 def colour(attrs = {}) model.colour = Vedeu::Colours::Colour .coerce(colour_attributes.merge!(attrs)) end |
#colour_attributes ⇒ Hash<Symbol => String> (private)
125 126 127 128 129 130 |
# File 'lib/vedeu/dsl/presentation.rb', line 125 def colour_attributes { background: model.colour.background, foreground: model.colour.foreground, } end |
#foreground(value = '') ⇒ Object Also known as: fg, fgcolor, foreground=, fg=, fgcolor=
51 52 53 |
# File 'lib/vedeu/dsl/presentation.rb', line 51 def foreground(value = '') colour(foreground: Vedeu::Colours::Foreground.coerce(value)) end |
#style(value) ⇒ Vedeu::Presentation::Style Also known as: style=, styles, styles=
Define a style or styles for an interface, line or a stream.
115 116 117 |
# File 'lib/vedeu/dsl/presentation.rb', line 115 def style(value) model.style = Vedeu::Presentation::Style.coerce(value) end |