1
0
Fork 0
mirror of https://github.com/heartcombo/simple_form.git synced 2022-11-09 12:19:26 -05:00

Hash#fetch FTW

This commit is contained in:
Vasiliy Ermolovich 2012-02-25 00:17:56 +03:00
parent 239b8dcfa8
commit b318d34282

View file

@ -20,16 +20,12 @@ module SimpleForm
protected
def apply_default_collection_options!(options)
unless options.key?(:item_wrapper_tag)
options[:item_wrapper_tag] = SimpleForm.item_wrapper_tag
end
options[:item_wrapper_tag] ||= options.fetch(:item_wrapper_tag, SimpleForm.item_wrapper_tag)
options[:item_wrapper_class] = [
item_wrapper_class, options[:item_wrapper_class], SimpleForm.item_wrapper_class
].compact.presence
unless options.key?(:collection_wrapper_tag)
options[:collection_wrapper_tag] = SimpleForm.collection_wrapper_tag
end
options[:collection_wrapper_tag] ||= options.fetch(:collection_wrapper_tag, SimpleForm.collection_wrapper_tag)
options[:collection_wrapper_class] = [
options[:collection_wrapper_class], SimpleForm.collection_wrapper_class
].compact.presence