i18n-debug 1.0.0 → 1.1.0

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
  SHA1:
3
- metadata.gz: 398a60a26ca4f57920cec51d480b9704c9dba002
4
- data.tar.gz: 3ea870dd5ea63a8b0f1fb8eb59bcb29c2d4541a7
3
+ metadata.gz: 70d7f6a748196e4de908ae5202aeed3a72cc6f0c
4
+ data.tar.gz: 31399b819b4e6d25c4ca20a0b1d947d21ac50122
5
5
  SHA512:
6
- metadata.gz: 055095420673af2a805e63727c2c07f01e3ed856c8704debebc26269adadbc30b26ab870b3c63eb1c45a00784b1797999e0716843af1012ce8798b6f7e994789
7
- data.tar.gz: e396e01eb9d4353657b2ba4241638318ed03e78bf20f298e40dc291025e8f10d652ce004ee14f2ddbac1834d2f233c43c16d55f321911778d893ecd5053ef6c3
6
+ metadata.gz: 16c9898163fbd402c99110bd4de352bb40663c10efce343df2e56e62e0053b66bb0c6731d81d48506675f61c48b6f5791819a46d2276473e8128d00fc93d6aa1
7
+ data.tar.gz: d9c004565cf75c236ef0d6a94b68e48694beeea570b89c1ac6f9cc01d45a7ef67d3ac65e1c4448c0de519a3847a08074c6c386c373387cd291b9ad17ebf7e45a
@@ -0,0 +1,8 @@
1
+ sudo: false
2
+ language: ruby
3
+ cache: bundler
4
+ script: "bundle exec rake test"
5
+ rvm:
6
+ - 2.2.2
7
+ - jruby-9.0.0.0
8
+ - rbx-2
@@ -0,0 +1,10 @@
1
+ # Changelog
2
+
3
+ ## 1.1.0
4
+
5
+ - Use `Module#prepend` instead of aliasing methods.
6
+ - Allow hook to be defined as a block to `#on_lookup`.
7
+
8
+ ## 1.0.0
9
+
10
+ - Initial release
data/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # Ruby I18n Debug
2
2
 
3
+ [![Build Status][build-image]][build-link]
4
+ [![Gem Version][gem-image]][gem-link]
5
+
3
6
  **Ever wondered which translations are being looked up by Rails, a gem, or
4
7
  simply your app? Wonder no more!**
5
8
 
@@ -33,6 +36,8 @@ Thus, place it inside the `development` group.
33
36
  gem 'i18n-debug', group: :development
34
37
  ```
35
38
 
39
+ If you need support for ruby < 2, make sure to use version 1.0.0.
40
+
36
41
  ## Usage
37
42
 
38
43
  This gem works straight out of the box. If Rails is available, it will log using
@@ -54,7 +59,7 @@ totally different, simply set your own handler to do so:
54
59
  # Collect stats on I18n key usage.
55
60
  i18n_stats = Hash.new { |stats, key| stats[key] = 0 }
56
61
 
57
- I18n::Debug.on_lookup = lambda do |key, value|
62
+ I18n::Debug.on_lookup do |key, value|
58
63
  i18n_stats[key] += 1 if value
59
64
  end
60
65
  ```
@@ -75,3 +80,8 @@ Philipe Fatio ([fphilipe](https://github.com/fphilipe))
75
80
  ### License
76
81
 
77
82
  MIT License. Copyright 2014 Philipe Fatio
83
+
84
+ [build-image]: https://travis-ci.org/fphilipe/i18n-debug.svg
85
+ [build-link]: https://travis-ci.org/fphilipe/i18n-debug
86
+ [gem-image]: https://badge.fury.io/rb/i18n-debug.svg
87
+ [gem-link]: https://rubygems.org/gems/i18n-debug
@@ -1,4 +1,4 @@
1
- require_relative 'lib/i18n/debug/version'
1
+ require File.expand_path('../lib/i18n/debug/version', __FILE__)
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = 'i18n-debug'
@@ -12,5 +12,8 @@ Gem::Specification.new do |spec|
12
12
  spec.summary = %q{Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!}
13
13
  spec.description = spec.summary
14
14
 
15
- spec.add_dependency 'i18n', '~> 0.0'
15
+ spec.add_development_dependency 'bundler', '~> 1.7'
16
+ spec.add_development_dependency 'rake', '~> 10.0'
17
+ spec.add_development_dependency 'minitest', '~> 5.8'
18
+ spec.add_dependency 'i18n', '< 1'
16
19
  end
@@ -8,7 +8,8 @@ module I18n
8
8
  end
9
9
 
10
10
  class << self
11
- attr_accessor :logger, :on_lookup
11
+ attr_accessor :logger
12
+ attr_writer :on_lookup
12
13
 
13
14
  def logger
14
15
  @logger ||=
@@ -19,18 +20,16 @@ module I18n
19
20
  ::Logger.new($stdout)
20
21
  end
21
22
  end
22
- end
23
23
 
24
- module Hook
25
- def self.included(klass)
26
- klass.class_eval do
27
- alias_method :lookup_without_debug, :lookup
28
- alias_method :lookup, :lookup_with_debug
29
- end
24
+ def on_lookup(&blk)
25
+ return @on_lookup unless block_given?
26
+ self.on_lookup = blk
30
27
  end
28
+ end
31
29
 
32
- def lookup_with_debug(*args)
33
- lookup_without_debug(*args).tap do |result|
30
+ module Hook
31
+ def lookup(*args)
32
+ super.tap do |result|
34
33
  options = args.last.is_a?(Hash) ? args.pop : {}
35
34
  separator = options[:separator] || I18n.default_separator
36
35
  key = I18n.normalize_keys(*args, separator).join(separator)
@@ -40,5 +39,5 @@ module I18n
40
39
  end
41
40
  end
42
41
 
43
- Backend::Simple.include(Debug::Hook)
42
+ Backend::Simple.prepend(Debug::Hook)
44
43
  end
@@ -1,5 +1,5 @@
1
1
  module I18n
2
2
  module Debug
3
- VERSION = '1.0.0'
3
+ VERSION = '1.1.0'
4
4
  end
5
5
  end
@@ -28,7 +28,7 @@ class TestI18nDebug < Minitest::Test
28
28
  def test_custom_lookup_hook_called
29
29
  default_hook = I18n::Debug.on_lookup
30
30
  hook_key, hook_value = nil
31
- I18n::Debug.on_lookup = lambda do |key, value|
31
+ I18n::Debug.on_lookup do |key, value|
32
32
  hook_key, hook_value = key, value
33
33
  end
34
34
 
metadata CHANGED
@@ -1,37 +1,80 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: i18n-debug
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipe Fatio
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-07 00:00:00.000000000 Z
11
+ date: 2015-08-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: i18n
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
16
  - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0.0'
20
- type: :runtime
18
+ version: '1.7'
19
+ name: bundler
20
+ prerelease: false
21
+ type: :development
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.7'
27
+ - !ruby/object:Gem::Dependency
28
+ requirement: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '10.0'
33
+ name: rake
34
+ prerelease: false
35
+ type: :development
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ requirement: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - "~>"
45
+ - !ruby/object:Gem::Version
46
+ version: '5.8'
47
+ name: minitest
21
48
  prerelease: false
49
+ type: :development
22
50
  version_requirements: !ruby/object:Gem::Requirement
23
51
  requirements:
24
52
  - - "~>"
25
53
  - !ruby/object:Gem::Version
26
- version: '0.0'
27
- description: Ever wondered which translations are being looked up by Rails, a gem,
28
- or simply your app? Wonder no more!
54
+ version: '5.8'
55
+ - !ruby/object:Gem::Dependency
56
+ requirement: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "<"
59
+ - !ruby/object:Gem::Version
60
+ version: '1'
61
+ name: i18n
62
+ prerelease: false
63
+ type: :runtime
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "<"
67
+ - !ruby/object:Gem::Version
68
+ version: '1'
69
+ description: Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!
29
70
  email: me@phili.pe
30
71
  executables: []
31
72
  extensions: []
32
73
  extra_rdoc_files: []
33
74
  files:
34
75
  - ".gitignore"
76
+ - ".travis.yml"
77
+ - CHANGELOG.md
35
78
  - Gemfile
36
79
  - LICENSE.txt
37
80
  - README.md
@@ -44,7 +87,7 @@ homepage: https://github.com/fphilipe/i18n-debug
44
87
  licenses:
45
88
  - MIT
46
89
  metadata: {}
47
- post_install_message:
90
+ post_install_message:
48
91
  rdoc_options: []
49
92
  require_paths:
50
93
  - lib
@@ -59,11 +102,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
59
102
  - !ruby/object:Gem::Version
60
103
  version: '0'
61
104
  requirements: []
62
- rubyforge_project:
63
- rubygems_version: 2.2.2
64
- signing_key:
105
+ rubyforge_project:
106
+ rubygems_version: 2.4.8
107
+ signing_key:
65
108
  specification_version: 4
66
- summary: Ever wondered which translations are being looked up by Rails, a gem, or
67
- simply your app? Wonder no more!
109
+ summary: Ever wondered which translations are being looked up by Rails, a gem, or simply your app? Wonder no more!
68
110
  test_files:
69
111
  - test/test_i18n_debug.rb