lib/hanami/view/rendered.rb in hanami-view-2.1.0.rc1 vs lib/hanami/view/rendered.rb in hanami-view-2.1.0.rc2
- old
+ new
@@ -2,26 +2,29 @@
require "dry/core/equalizer"
module Hanami
class View
- # Output of a View rendering
+ # The output of a view rendering.
#
# @api public
# @since 2.1.0
class Rendered
include Dry::Equalizer(:output, :locals)
- # Returns the rendered view
+ # Returns the rendered view output.
#
# @return [String]
#
+ # @see to_s
+ # @see to_str
+ #
# @api public
# @since 2.1.0
attr_reader :output
- # Returns the hash of locals used to render the view
+ # Returns the hash of locals used to render the view output.
#
# @return [Hash[<Symbol, Hanami::View::Part>] locals hash
#
# @api public
# @since 2.1.0
@@ -32,11 +35,11 @@
def initialize(output:, locals:)
@output = output
@locals = locals
end
- # Returns the local corresponding to the key
+ # Returns the local corresponding to the key.
#
# @param name [Symbol] local key
#
# @return [Hanami::View::Part]
#
@@ -44,22 +47,25 @@
# @since 2.1.0
def [](name)
locals[name]
end
- # Returns the rendered view
+ # Returns the rendered view output.
#
# @return [String]
#
# @api public
# @since 2.1.0
def to_s
output
end
+
+ # @api public
+ # @since 2.1.0
alias_method :to_str, :to_s
- # Matches given input with the rendered view
+ # Returns true if the given input matches the rendered view output.
#
# @param matcher [String, Regexp] matcher
#
# @return [TrueClass,FalseClass]
#
@@ -68,10 +74,10 @@
def match?(matcher)
output.match?(matcher)
end
alias_method :match, :match?
- # Checks if given string is included in the rendered view
+ # Returns true if given string is included in the rendered view output.
#
# @param string [String] string
#
# @return [TrueClass,FalseClass]
#