Module: Vedeu::Presentation::Styles Private

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Provides style related presentation behaviour.

Instance Method Summary collapse

Methods included from Parent

#name, #parent, #parent?

Methods included from Common

#absent?, #array?, #boolean, #boolean?, #empty_value?, #escape?, #falsy?, #hash?, #line_model?, #numeric?, #positionable?, #present?, #snake_case, #stream_model?, #string?, #symbol?, #truthy?, #view_model?

Instance Method Details

#render_style(&block) ⇒ String (private)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Renders the style attributes of the receiver and yields (to then render the next model, or finally, the content).

Parameters:

  • block (Proc)

Returns:

  • (String)


54
55
56
# File 'lib/vedeu/presentation/styles.rb', line 54

def render_style(&block)
  "#{style}#{yield}"
end

#styleVedeu::Presentation::Style

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

When the style for the model exists, return it, otherwise returns the parent style, or an empty Vedeu::Presentation::Style.



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/vedeu/presentation/styles.rb', line 21

def style
  @_style ||= if style?
                Vedeu::Presentation::Style.coerce(@style)

              elsif parent? && present?(parent.style)
                Vedeu::Presentation::Style.coerce(parent.style)

              else
                Vedeu::Presentation::Style.new

              end
end

#style=(value) ⇒ Vedeu::Presentation::Style

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Allows the setting of the style by coercing the given value into a Vedeu::Presentation::Style.



38
39
40
# File 'lib/vedeu/presentation/styles.rb', line 38

def style=(value)
  @_style = @style = Vedeu::Presentation::Style.coerce(value)
end

#style?Boolean

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns:



43
44
45
# File 'lib/vedeu/presentation/styles.rb', line 43

def style?
  present?(@style)
end