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

#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

#nameNilClass|String|Symbol

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:

  • (NilClass|String|Symbol)


17
18
19
20
21
22
23
24
25
# File 'lib/vedeu/presentation/styles.rb', line 17

def name
  if present?(@name)
    @name

  elsif parent && present?(parent.name)
    parent.name

  end
end

#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)


60
61
62
# File 'lib/vedeu/presentation/styles.rb', line 60

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.



32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/vedeu/presentation/styles.rb', line 32

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.



49
50
51
# File 'lib/vedeu/presentation/styles.rb', line 49

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