sonnet 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bdf5b36a10d488d4e99a45a1341adae68639e2cf7b78177c4b5a343768676f56
4
- data.tar.gz: 766ea1806f922074e2524ab6d430c6dcd4cd596edcefcd29c76e50deafdccf8a
3
+ metadata.gz: 4c4641035ac6ac2af9894fde837738f9a3b0b1fc8f1d625c8f6ed3ffbb7a8f45
4
+ data.tar.gz: 03651c0c7a9162c27f92783ab482147d263e88d0fe972b1ab7a7c65a9b4a51be
5
5
  SHA512:
6
- metadata.gz: 17a5c66a3641e776facb3bcdcac5e85722a31e5aca95915e8e639d2e7415bc94dcd7e1be4b856b99883d03df73fa53a78ec4d1d0b10fb362b0fe977af320f0ea
7
- data.tar.gz: 9b6c95572efa27e5179134c92eda5650490de3dc8ad856f1bbad171e86a4836976631a49f30e9cd5f36a0c843f3299cc5a39e0a9d065197c796f2e5a46e87db3
6
+ metadata.gz: b6f95461bbe2e78cbb571822c92ab8eb246bfc9c2920c501ab2cf2333489e5f1b3e1d5dd9c40c933c36091926107be37d3f83a548ec449ba9ccf65b3956620f4
7
+ data.tar.gz: 554d1034d5a275fdaec1379ad1ae8f32309a467f2cc1a239086397fe9ba5171d0ec082e51f11ed8af893ceadd06842a793bf0e78edec1c13b911c7181cc53e93
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- sonnet (0.1.7)
4
+ sonnet (0.1.8)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/sonnet/rails.rb CHANGED
@@ -24,14 +24,26 @@ module Sonnet
24
24
 
25
25
  def tagged(*tags, &block)
26
26
  if tags.present?
27
- with_context(tags: tags, &block)
27
+ with_context(tags: tags.flatten, &block)
28
28
  else
29
29
  yield self
30
30
  end
31
31
  end
32
32
  end
33
33
 
34
+ module RailsFormatter
35
+ def current_tags
36
+ current_context.inject([]) do |memo, context|
37
+ memo + [*context[:tags]].flatten.compact
38
+ end
39
+ end
40
+ end
41
+
34
42
  module Logger
35
43
  include RailsLogger
36
44
  end
45
+
46
+ class Formatter
47
+ extend RailsFormatter
48
+ end
37
49
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Sonnet
4
- VERSION = "0.1.7"
4
+ VERSION = "0.1.8"
5
5
  end
@@ -33,4 +33,11 @@ class LoggerTest < Minitest::Test
33
33
  assert_equal log[0].slice(:color, :message), color: "blue", message: "What's the story, morning glory?"
34
34
  assert_equal log[1].slice(:color, :message), message: "definitely maybe"
35
35
  end
36
+
37
+ def test_new
38
+ logger = Sonnet::Logger.new(Logger.new(io))
39
+ assert_equal logger.formatter, Sonnet::Formatter
40
+ logger.info("What's the story, morning glory?")
41
+ assert_log_line log[0], level: "info", message: "What's the story, morning glory?"
42
+ end
36
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sonnet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cory Kaufman-Schofield
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-16 00:00:00.000000000 Z
11
+ date: 2019-05-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -103,9 +103,9 @@ files:
103
103
  - lib/sonnet/rails_monkeypatch.rb
104
104
  - lib/sonnet/version.rb
105
105
  - sonnet.gemspec
106
- - test/logger_test.rb
107
106
  - test/rails_logger_test.rb
108
107
  - test/sonnet/formatter_test.rb
108
+ - test/sonnet/logger_test.rb
109
109
  - test/test_helper.rb
110
110
  homepage: https://github.com/allspiritseve/sonnet
111
111
  licenses: