Sha256: 7630a29c9e5e761f3c5025929f67b0d693ebaa1ae7d98a82e2545a47e3610285
Contents?: true
Size: 1.23 KB
Versions: 2
Compression:
Stored size: 1.23 KB
Contents
require 'vedeu/geometries/positionable' module Vedeu module Presentation include Vedeu::Geometries::Positionable include Vedeu::Presentation::Colour include Vedeu::Presentation::Styles # 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. # # @return [String] An escape sequence with value interpolated. def to_s render_position { render_colour { render_style { value } } } end alias_method :to_str, :to_s private # Renders the colour attributes of the receiver and yields (to # then render the styles). # # @param block [Proc] # @return [String] def render_colour(&block) "#{colour}#{yield}".freeze end # @param block [Proc] # @return [String] def render_position(&block) return position.to_s { yield } if position? yield end # Renders the style attributes of the receiver and yields (to # then render the next model, or finally, the content). # # @param block [Proc] # @return [String] def render_style(&block) "#{style}#{yield}".freeze end end # Presentation end # Vedeu
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
vedeu-0.8.0 | lib/vedeu/presentation/presentation.rb |
vedeu-0.7.4 | lib/vedeu/presentation/presentation.rb |