scrolls-minimal 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/scrolls.rb +11 -2
  2. metadata +3 -3
data/lib/scrolls.rb CHANGED
@@ -1,8 +1,17 @@
1
1
  module Scrolls
2
2
  module Log
3
3
  def log(action, attrs = {})
4
- str = "#{action} #{unparse(attrs)}"
5
- mtx.synchronize { $stdout.puts str }
4
+ unless block_given?
5
+ str = "#{action} #{unparse(attrs)}"
6
+ mtx.synchronize { $stdout.puts str }
7
+ else
8
+ start = Time.now
9
+ log(action, attrs.merge(at: :start))
10
+ res = yield
11
+ log(action, attrs.merge(at: :finish,
12
+ elapsed: "#{((Time.now - start) * 1000).to_i}ms"))
13
+ res
14
+ end
6
15
  end
7
16
 
8
17
  private
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scrolls-minimal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Brandur
9
- autorequire: scrolls
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-10 00:00:00.000000000 Z
12
+ date: 2012-06-17 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: brandur@mutelight.org