Module: Vedeu::DSL::Presentation
- Included in:
- Borders::DSL, Elements, 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=)
-
#no_wordwrap! ⇒ Boolean
Instruct the view to not use wordwrapping.
-
#style(value) ⇒ Vedeu::Presentation::Style
(also: #style=, #styles, #styles=)
Define a style or styles for an interface, line or a stream.
-
#wordwrap(value = true) ⇒ Boolean
(also: #wordwrap!)
Specify whether the view should use wordwrapping (default).
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.
43 44 45 |
# File 'lib/vedeu/dsl/presentation.rb', line 43 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.
91 92 93 94 |
# File 'lib/vedeu/dsl/presentation.rb', line 91 def colour(attrs = {}) model.colour = Vedeu::Colours::Colour .coerce(colour_attributes.merge!(attrs)) end |
#colour_attributes ⇒ Hash<Symbol => String> (private)
144 145 146 147 148 149 |
# File 'lib/vedeu/dsl/presentation.rb', line 144 def colour_attributes { background: model.colour.background, foreground: model.colour.foreground, } end |
#foreground(value = '') ⇒ Object Also known as: fg, fgcolor, foreground=, fg=, fgcolor=
53 54 55 |
# File 'lib/vedeu/dsl/presentation.rb', line 53 def foreground(value = '') colour(foreground: Vedeu::Colours::Foreground.coerce(value)) end |
#no_wordwrap! ⇒ Boolean
Instruct the view to not use wordwrapping. (Default)
100 101 102 |
# File 'lib/vedeu/dsl/presentation.rb', line 100 def no_wordwrap! wordwrap(false) end |
#style(value) ⇒ Vedeu::Presentation::Style Also known as: style=, styles, styles=
Define a style or styles for an interface, line or a stream.
125 126 127 |
# File 'lib/vedeu/dsl/presentation.rb', line 125 def style(value) model.style = Vedeu::Presentation::Style.coerce(value) end |