Module: Vedeu::Presentation
- Included in:
- Borders::Border, Models::Interface, Null::Interface, Null::View, Views::Char, Views::Composition, Views::Line, Views::Stream, Views::View
- Defined in:
- lib/vedeu/output/presentation/presentation.rb,
lib/vedeu/output/presentation/style.rb,
lib/vedeu/output/presentation/colour.rb,
lib/vedeu/output/presentation/styles.rb
Overview
This module allows the sharing of presentation concerns between the models: Interface, View, Line and Stream.
Defined Under Namespace
Modules: Colour, Styles Classes: Style
Instance Method Summary collapse
-
#render_colour ⇒ String
private
Renders the colour attributes of the receiver and yields (to then render the styles).
- #render_position ⇒ String private
-
#render_style ⇒ String
private
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
-
#to_s ⇒ String
(also: #to_str)
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
Methods included from Styles
Methods included from Colour
#background, #background=, #colour, #colour=, #foreground, #foreground=
Instance Method Details
#render_colour ⇒ String (private)
Renders the colour attributes of the receiver and yields (to then render the styles).
31 32 33 |
# File 'lib/vedeu/output/presentation/presentation.rb', line 31 def render_colour "#{colour}#{yield}" end |
#render_position ⇒ String (private)
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/vedeu/output/presentation/presentation.rb', line 36 def render_position if self.respond_to?(:position) && position.is_a?(Vedeu::Geometry::Position) position.to_s { yield } else yield end end |
#render_style ⇒ String (private)
Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).
51 52 53 |
# File 'lib/vedeu/output/presentation/presentation.rb', line 51 def render_style "#{style}#{yield}" end |
#to_s ⇒ String Also known as: to_str
Converts the colours and styles to escape sequences, and when the parent model has previously set the colour and style, reverts back to that for consistent formatting.
20 21 22 |
# File 'lib/vedeu/output/presentation/presentation.rb', line 20 def to_s render_position { render_colour { render_style { value } } } end |