Class: Array
Instance Method Summary collapse
-
#list_join(sep = ', ') ⇒ Object
Join an array’s values ignoring blank entries.
-
#rand(count = 1) ⇒ Object
DEPRECATED: as of Ruby 1.9, you should use Array#sample instead.
-
#rand!(count = 1) ⇒ Object
DEPRECATED: as of Ruby 1.9, you should use Array#sample instead.
Instance Method Details
#list_join(sep = ', ') ⇒ Object
Join an array’s values ignoring blank entries
16 17 18 |
# File 'lib/iron/extensions/array.rb', line 16 def list_join(sep = ', ') self.select{|e| !e.blank?}.join(sep) end |
#rand(count = 1) ⇒ Object
DEPRECATED: as of Ruby 1.9, you should use Array#sample instead
4 5 6 7 |
# File 'lib/iron/extensions/array.rb', line 4 def rand(count = 1) warn("[DEPRECATION] Array#rand is deprecated - use Array#sample instead") shuffle[0...count] end |
#rand!(count = 1) ⇒ Object
DEPRECATED: as of Ruby 1.9, you should use Array#sample instead
10 11 12 13 |
# File 'lib/iron/extensions/array.rb', line 10 def rand!(count = 1) warn("[DEPRECATION] Array#rand is deprecated - use Array#sample instead") self.replace rand(count) end |