Sha256: 8b5787b1a5cb817639d7d1348ce2b0e761a4ca5f86a2a1c150b3632ea82b873c

Contents?: true

Size: 1.17 KB

Versions: 8

Compression:

Stored size: 1.17 KB

Contents

module Vedeu

  module Presentation

    # Provides style related presentation behaviour.
    #
    module Styles

      include Vedeu::Common
      include Vedeu::Repositories::Parent

      # When the style for the model exists, return it, otherwise
      # returns the parent style, or an empty
      # {Vedeu::Presentation::Style}.
      #
      # @return [Vedeu::Presentation::Style]
      def style
        @_style ||= if @style
                      Vedeu::Presentation::Style.coerce(@style)

                    elsif self.is_a?(Vedeu::Views::Char) && name
                      Vedeu::Presentation::Style.coerce(interface.style)

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

                    else
                      Vedeu::Presentation::Style.new

                    end
      end

      # Allows the setting of the style by coercing the given value
      # into a {Vedeu::Presentation::Style}.
      #
      # @return [Vedeu::Presentation::Style]
      def style=(value)
        @_style = @style = Vedeu::Presentation::Style.coerce(value)
      end

    end # Style

  end # Presentation

end # Vedeu

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
vedeu-0.8.0 lib/vedeu/presentation/styles.rb
vedeu-0.7.4 lib/vedeu/presentation/styles.rb
vedeu-0.7.3 lib/vedeu/presentation/styles.rb
vedeu-0.7.2 lib/vedeu/presentation/styles.rb
vedeu-0.7.1 lib/vedeu/presentation/styles.rb
vedeu-0.7.0 lib/vedeu/presentation/styles.rb
vedeu-0.6.71 lib/vedeu/presentation/styles.rb
vedeu-0.6.70 lib/vedeu/presentation/styles.rb