No description, website, or topics provided.
Ruby
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.document
.gitignore
.rspec
Gemfile
Gemfile.lock
LICENSE.txt
README.rdoc
Rakefile
VERSION
each-with-logging.gemspec

README.rdoc

each-with-logging

each_with_logging will warn caller, index and length.

require 'each-with-logging'

[1,2,3,4].each_with_logging {|i|
  p i
}

# m.rb:3:in `<main>' 1 / 4
# 1
# m.rb:3:in `<main>' 2 / 4
# 2
# m.rb:3:in `<main>' 3 / 4
# 3
# m.rb:3:in `<main>' 4 / 4
# 4

You can use each_with_logging with Logger.

require 'each-with-logging'
require 'logger'
logger = Logger.new(STDOUT)

[1,2,3,4].each_with_logging(logger) {|i|
  p i
}

# D, [2011-03-07T10:55:48.014898 #92103] DEBUG -- : l.rb:5:in `<main>' 1 / 4
# 1
# D, [2011-03-07T10:55:48.015350 #92103] DEBUG -- : l.rb:5:in `<main>' 2 / 4
# 2
# D, [2011-03-07T10:55:48.015722 #92103] DEBUG -- : l.rb:5:in `<main>' 3 / 4
# 3
# D, [2011-03-07T10:55:48.015977 #92103] DEBUG -- : l.rb:5:in `<main>' 4 / 4
# 4

Copyright

Copyright © 2011 hitode909. See LICENSE.txt for further details.