Skip to content

Instantly share code, notes, and snippets.

@itabatakafumi
Created May 18, 2010 09:53
Show Gist options
  • Save itabatakafumi/404830 to your computer and use it in GitHub Desktop.
Save itabatakafumi/404830 to your computer and use it in GitHub Desktop.
---repeat_joinメソッド
def repeat_join(array)
array.inject{ |a,b| a << "," << b }
end
---odd_sumメソッド
def odd_sum(array)
array.select{ |i| i % 2 == 1}.inject{ |a,b| a + b }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment