lioooo_utils 0.3.4 → 0.3.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/lib/lioooo_log.rb +16 -1
  2. data/lib/utils.rb +1 -0
  3. metadata +3 -3
@@ -1,6 +1,7 @@
1
1
  #encoding: utf-8
2
2
  require 'colored'
3
3
  require 'logging'
4
+ require 'benchmark'
4
5
  LogRoot = File.expand_path("../../log", __FILE__)
5
6
  class LiooooUtilsLogger
6
7
  attr_accessor :logger, :log_dir
@@ -69,10 +70,24 @@ class LiooooUtilsLogger
69
70
  system "source ~/.bash_profile && #{cmd}"
70
71
  end
71
72
 
73
+ # print block exec time
74
+ def real_time &block
75
+ if block_given?
76
+ elapsed = Benchmark.realtime do
77
+ yield
78
+ end
79
+ warn "执行完毕: #{(elapsed).round(2)} 毫秒!"
80
+ end
81
+ end
82
+
83
+
72
84
  end
73
85
 
74
86
  # need init when use it
75
- #LiooooLogger = LiooooUtilsLogger.new :lioooo
87
+ #LiooooLogger = LiooooUtilsLogger.new :lioooo, "/tmp"
88
+ #LiooooLogger.ba do |ele|
89
+ # sleep 3
90
+ #end
76
91
 
77
92
 
78
93
 
@@ -51,6 +51,7 @@ class LiooooUtils
51
51
  ENV['USER']
52
52
  end
53
53
 
54
+
54
55
  end
55
56
  end
56
57
  #puts LiooooUtils.username
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lioooo_utils
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.4
4
+ version: 0.3.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-04-23 00:00:00.000000000 Z
12
+ date: 2014-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: colored
@@ -172,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
172
172
  version: '0'
173
173
  segments:
174
174
  - 0
175
- hash: 1777591074401565210
175
+ hash: -1136961478188097229
176
176
  required_rubygems_version: !ruby/object:Gem::Requirement
177
177
  none: false
178
178
  requirements: