lib/blocks/base.rb in blocks-2.2.1 vs lib/blocks/base.rb in blocks-2.3.0

- old
+ new

@@ -1,7 +1,9 @@ module Blocks class Base + include CallWithParams + # a pointer to the ActionView that called Blocks attr_accessor :view # Hash of block names to Blocks::Container objects attr_accessor :blocks @@ -55,11 +57,11 @@ def define(name, options={}, &block) collection = options.delete(:collection) if collection collection.each do |object| - define(view.call_if_proc(name, object, options), options, &block) + define(call_with_params(name, object, options), options, &block) end else self.define_block_container(name, options, &block) end @@ -153,11 +155,11 @@ cloned_args.unshift(object) cloned_options = options.clone cloned_options = cloned_options.merge(object.options) if object.is_a?(Blocks::Container) cloned_args.push(cloned_options) - block_name = view.call_if_proc(name_or_container, *cloned_args) + block_name = call_with_params(name_or_container, *cloned_args) as_name = (as.presence || block_name).to_sym cloned_options[as_name] = object buffer << render(block_name, *cloned_args, &block) end @@ -655,10 +657,10 @@ block_container end def content_tag(tag, tag_html, *args, &block) if tag - view.content_tag(tag, block.call, view.call_each_hash_value_if_proc(tag_html, *args)) + view.content_tag(tag, block.call, call_each_hash_value_with_params(tag_html, *args)) else block.call end end end