Sha256: 4e921ec56677c13e25f528485c4996003f0208286a55ae979975d041ef25b01d

Contents?: true

Size: 508 Bytes

Versions: 5

Compression:

Stored size: 508 Bytes

Contents

class Hash

  def not_empty?
    !self.empty?
  end

  #This method iterates over the Array as normal #each method.  For each iteration
  #set two variables in the block, |item, flag|. item will be set tot he current item
  #in the iteration; flag will be set to "false" on all iterations except the last iteration
  def each_with_end_flag
    my_size = self.size
    self.each_with_index do |item, index|
      index + 1 == my_size ? yield(item, true) : yield(item, false)
    end
  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
corelib-0.0.6 lib/corelib/hash/core.rb
corelib-0.0.5 lib/corelib/hash/core.rb
corelib-0.0.4 lib/corelib/hash/core.rb
corelib-0.0.3 lib/corelib/hash/core.rb
corelib-0.0.2 lib/corelib/hash/core.rb