Change :klass option to :class

This commit is contained in:
Andrew Haines 2012-10-06 16:37:31 +01:00
parent 924352329f
commit 1dae18a064
2 changed files with 7 additions and 7 deletions

View File

@ -12,13 +12,13 @@ module Draper
#
# @param [Object] instances to wrap
# @param [Hash] options (optional)
# @option options [Class] :klass The decorator class to use
# @option options [Class] :class The decorator class to use
# for each item in the collection.
# @option options all other options are passed to Decorator
# class for each item.
def self.decorate(collection, options = {})
new( collection, discern_class_from_my_class(options.delete(:klass)), options)
new( collection, discern_class_from_my_class(options.delete(:class)), options)
end
class << self
alias_method :decorates, :decorate
@ -72,12 +72,12 @@ module Draper
@wrapped_collection
end
alias_method :to_source, :source
def helpers
Draper::ViewContext.current
end
alias_method :h, :helpers
private
def self.discern_class_from_my_class default_class
return default_class if default_class

View File

@ -26,8 +26,8 @@ describe Draper::DecoratedEnumerableProxy do
EnumerableProxy.new([source], ProductDecorator).first.model.should == source
end
it "decorates an empty array with the klass" do
EnumerableProxy.decorates([], klass: ProductDecorator).should be
it "decorates an empty array with the class" do
EnumerableProxy.decorates([], class: ProductDecorator).should be
end
it "discerns collection items decorator by the name of the decorator" do