def some_method(format, language) raise Error unless %w(wiki xml).include?(format.to_s) raise Error unless %w(de en).include?(language.to_s) ...
Ruby Check for bounds
a = {}
a["test"] = [] if a["test"].nil?
a["test"] << 5
Ruby Fill Array or create it
How can I write this in a c...
a = ["a", "b", "c", "d"] b = [1, 0, 0, 1] ...
Ruby Reject and merge two arrays
I want to collect all the e...
<%= form_for :page, :url => { :action => :create } do |form| %>
<div class="tabs">
...
Ruby Rails Helper extraction
by Fu86,
September 13, 2010 13:45,
No refactoring
I want to make this thing m...
def create_files
%w{ 10K 100K 500K 1M 2M 5M 10M 20M }.map do |size|
100.times.map {|index| create_file(size)}
...
def parse_url(url)
matches = url.match(/\/([\d]{10})/)
return nil unless matches
...
Ruby Return nil if nothing matched
I want to return nil if not...

I need to check the given i...