RubyGems Navigation menu

devnull 0.1.1

DevNull behaves a null file, and works like an IO object. For example: dn = DevNull.new dn.puts "foo" # => nil (do nothing) dn.gets # => nil dn.read # => "" The library may be a good solution if you would like to switch whether an input/output file is needed. For example: def some_process(arg, logfile = nil) # You may set an IO object as 'logfile', and logs are written to the file. result = process1(arg) logfile.puts result if logfile result = process2(arg) logfile.puts result if logfile result = process3(arg) logfile.puts result if logfile end can be rewritten as follows: def some_process(arg, logfile = DevNull.new) logfile.puts process1(arg) logfile.puts process2(arg) logfile.puts process3(arg) end

版本列表:

  1. 0.1.3 - May 24, 2019 (9.0 KB)
  2. 0.1.2 - February 20, 2015 (8.5 KB)
  3. 0.1.1 - June 27, 2013 (8.5 KB)
  4. 0.1.0 - March 27, 2011 (9.5 KB)

Development 依赖关系 (2):

  • hoe ~> 3.6
  • rdoc ~> 4.0
  • 所有者:

    作者:

    • H.Hiro (maraigue)

    SHA 256 checksum:

    00eeae3b9e8ee9743e8516143d176c35d9acc1836b11d3b8613ed3358d3a50a3

    下载总次数 22,764

    这个版本 6,815

    Gemfile:
    = 复制到剪贴板 已复制

    安装:
    =

    许可:

    需要的 Ruby 版本:

    相关链接: