class Hanami::View::Rendered
The output of a view rendering.
@api public @since 2.1.0
Attributes
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
Public Class Methods
Source
# File lib/hanami/view/rendered.rb, line 35 def initialize(output:, locals:) @output = output @locals = locals end
@api private @since 2.1.0
Public Instance Methods
Source
# File lib/hanami/view/rendered.rb, line 48 def [](name) locals[name] end
Returns the local corresponding to the key.
@param name [Symbol] local key
@return [Hanami::View::Part]
@api public @since 2.1.0
Source
# File lib/hanami/view/rendered.rb, line 87 def include?(string) output.include?(string) end
Returns true if given string is included in the rendered view output.
@param string [String] string
@return [TrueClass,FalseClass]
@api public @since 2.1.0
Source
# File lib/hanami/view/rendered.rb, line 74 def match?(matcher) output.match?(matcher) end
Returns true if the given input matches the rendered view output.
@param matcher [String, Regexp] matcher
@return [TrueClass,FalseClass]
@api public @since 2.1.0
Also aliased as: match
Source
# File lib/hanami/view/rendered.rb, line 58 def to_s output end
Returns the rendered view output.
@return [String]
@api public @since 2.1.0
Also aliased as: to_str