class ScriptFlow::Map

Attributes

content[R]

Public Class Methods

new() click to toggle source
# File lib/script_flow/model/map.rb, line 7
def initialize
  @content = ActiveSupport::OrderedHash.new { |h,k| h[k] = ActiveSupport::SafeBuffer.new }
end

Public Instance Methods

add_script(script) click to toggle source
# File lib/script_flow/model/map.rb, line 27
def add_script(script)
  set(script.hash, script)
end
append(key, value) click to toggle source

Called by content_for

# File lib/script_flow/model/map.rb, line 22
def append(key, value)
  @content[key] << value
end
Also aliased as: append!
append!(key, value)
Alias for: append
get(key) click to toggle source

Called by _layout_for to read stored values.

# File lib/script_flow/model/map.rb, line 12
def get(key)
  @content[key]
end
render() click to toggle source
# File lib/script_flow/model/map.rb, line 31
def render
  @content.values.join("\n").html_safe
end
set(key, value) click to toggle source

Called by each renderer object to set the layout contents.

# File lib/script_flow/model/map.rb, line 17
def set(key, value)
  @content[key] = value
end