Sha256: 09cd65ee4385ed917d63f5ba4f4189771e8f122054a48375c0491c5d223b71ad

Contents?: true

Size: 483 Bytes

Versions: 9

Compression:

Stored size: 483 Bytes

Contents

module HookHelper
  
  # Allow hooks to be used in views like this:
  # 
  #   <%= hook :some_hook %>
  #
  #   <%= hook :some_hook do %>
  #     <p>Some HTML</p>
  #   <% end %>
  # 
  def hook(hook_name, locals = {}, &block)
    content = block_given? ? capture(&block) : ''
    Spree::ThemeSupport::Hook.render_hook(hook_name, content, self, locals)
  end

  def locals_hash(names, binding)
    names.inject({}) {|memo, key| memo[key.to_sym] = eval(key, binding); memo}
  end

end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
spree_core-0.30.2 app/helpers/hook_helper.rb
spree_core-0.40.4 app/helpers/hook_helper.rb
spree_core-0.40.3 app/helpers/hook_helper.rb
spree_core-0.40.2 app/helpers/hook_helper.rb
spree_core-0.40.1 app/helpers/hook_helper.rb
spree_core-0.40.0 app/helpers/hook_helper.rb
spree_core-0.30.1 app/helpers/hook_helper.rb
spree_core-0.30.0 app/helpers/hook_helper.rb
spree_core-0.30.0.beta1 app/helpers/hook_helper.rb