Skip to content
This repository
Browse code

use extract_options! in cycle helper

  • Loading branch information...
commit fd3f550c949fda5d3f9d008bf90091dc151d006f 1 parent bcd2269
Sergey Nartimov authored
10  actionpack/lib/action_view/helpers/text_helper.rb
... ...
@@ -1,5 +1,6 @@
1 1
 require 'active_support/core_ext/object/blank'
2 2
 require 'active_support/core_ext/string/filters'
  3
+require 'active_support/core_ext/array/extract_options'
3 4
 
4 5
 module ActionView
5 6
   # = Action View Text Helpers
@@ -306,12 +307,9 @@ def simple_format(text, html_options={}, options={})
306 307
       #    </tr>
307 308
       #  <% end %>
308 309
       def cycle(first_value, *values)
309  
-        if (values.last.instance_of? Hash)
310  
-          params = values.pop
311  
-          name = params[:name]
312  
-        else
313  
-          name = "default"
314  
-        end
  310
+        options = values.extract_options!
  311
+        name = options.fetch(:name, "default")
  312
+
315 313
         values.unshift(first_value)
316 314
 
317 315
         cycle = get_cycle(name)

0 notes on commit fd3f550

Please sign in to comment.
Something went wrong with that request. Please try again.