renc 0.2.0 → 1.0.0
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.
- checksums.yaml +4 -4
 - data/.rubocop.yml +14 -0
 - data/.rubocop_todo.yml +0 -0
 - data/.travis.yml +2 -3
 - data/CAHNGELOG.md +9 -0
 - data/Gemfile +2 -0
 - data/README.md +23 -0
 - data/bin/console +4 -4
 - data/lib/renc.rb +10 -6
 - data/lib/renc/version.rb +1 -1
 - data/renc.gemspec +2 -0
 - metadata +5 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8b37aa5ea23c2d62516fb961f243cf75f611d8a7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: c2eece2df16dcbf6b81bcfc176d99661c25d14e1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 1761bfd89920e0d4f5f1f39efa483d1d591669bfe853b45adad8c9c802148a15de1d1f87daf1753246d8237a7586373e7f1f13d7da3eec49c132c12b7c7c3e67
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 85f8565ede7fe37f109fe69a68040084703332983b6e0b30f0880d784b01554d3a5126cf11088db4a052cc5a504fd143461018febd12a8dc75c9ac56b6d36012
         
     | 
    
        data/.rubocop.yml
    ADDED
    
    
    
        data/.rubocop_todo.yml
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/.travis.yml
    CHANGED
    
    
    
        data/CAHNGELOG.md
    CHANGED
    
    | 
         @@ -1,3 +1,12 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # v1.0.0
         
     | 
| 
      
 2 
     | 
    
         
            +
            - base method change from singleton_method to instance_method.
         
     | 
| 
      
 3 
     | 
    
         
            +
            - renc method is implemented.
         
     | 
| 
      
 4 
     | 
    
         
            +
            - enc method is deprecated.
         
     | 
| 
      
 5 
     | 
    
         
            +
            - required Ruby version is change to over 2.2.4.
         
     | 
| 
      
 6 
     | 
    
         
            +
              - gemspec: `spec.required_ruby_version = '>= 2.2.4'`
         
     | 
| 
      
 7 
     | 
    
         
            +
                - maybe, be able to run on `version >= 2.0.0`.
         
     | 
| 
      
 8 
     | 
    
         
            +
              - Travis CI: 2.2.4, 2.3.0
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
       1 
10 
     | 
    
         
             
            # v0.2.0
         
     | 
| 
       2 
11 
     | 
    
         
             
            - implement base features.
         
     | 
| 
       3 
12 
     | 
    
         | 
    
        data/Gemfile
    CHANGED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,3 +1,9 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            [![Gem Version][gem_version-svg]][gem_version]
         
     | 
| 
      
 2 
     | 
    
         
            +
            [![Build Status][travis-svg]][travis]
         
     | 
| 
      
 3 
     | 
    
         
            +
            [![Code Climate][codeclimate-svg]][codeclimate]
         
     | 
| 
      
 4 
     | 
    
         
            +
            [![Test Coverage][codeclimate_cov-svg]][codeclimate_cov]
         
     | 
| 
      
 5 
     | 
    
         
            +
            [![Inline docs][inch-ci-svg]][inch-ci]
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
       1 
7 
     | 
    
         
             
            # Renc
         
     | 
| 
       2 
8 
     | 
    
         | 
| 
       3 
9 
     | 
    
         
             
            Welcome to your new gem!
         
     | 
| 
         @@ -69,3 +75,20 @@ and contributors are expected to adhere to the 
     | 
|
| 
       69 
75 
     | 
    
         | 
| 
       70 
76 
     | 
    
         
             
            The gem is available as open source
         
     | 
| 
       71 
77 
     | 
    
         
             
            under the terms of the [MIT License](http://opensource.org/licenses/MIT).
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
             
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            [gem_version]: http://badge.fury.io/rb/renc
         
     | 
| 
      
 82 
     | 
    
         
            +
            [gem_version-svg]: https://badge.fury.io/rb/renc.svg
         
     | 
| 
      
 83 
     | 
    
         
            +
             
     | 
| 
      
 84 
     | 
    
         
            +
            [travis]: https://travis-ci.org/k-ta-yamada/renc
         
     | 
| 
      
 85 
     | 
    
         
            +
            [travis-svg]: https://travis-ci.org/k-ta-yamada/renc.svg
         
     | 
| 
      
 86 
     | 
    
         
            +
             
     | 
| 
      
 87 
     | 
    
         
            +
            [codeclimate]: https://codeclimate.com/github/k-ta-yamada/renc
         
     | 
| 
      
 88 
     | 
    
         
            +
            [codeclimate-svg]: https://codeclimate.com/github/k-ta-yamada/renc/badges/gpa.svg
         
     | 
| 
      
 89 
     | 
    
         
            +
             
     | 
| 
      
 90 
     | 
    
         
            +
            [codeclimate_cov]: https://codeclimate.com/github/k-ta-yamada/renc/coverage
         
     | 
| 
      
 91 
     | 
    
         
            +
            [codeclimate_cov-svg]: https://codeclimate.com/github/k-ta-yamada/renc/badges/coverage.svg
         
     | 
| 
      
 92 
     | 
    
         
            +
             
     | 
| 
      
 93 
     | 
    
         
            +
            [inch-ci]: http://inch-ci.org/github/k-ta-yamada/renc
         
     | 
| 
      
 94 
     | 
    
         
            +
            [inch-ci-svg]: http://inch-ci.org/github/k-ta-yamada/renc.svg?branch=master
         
     | 
    
        data/bin/console
    CHANGED
    
    | 
         @@ -7,8 +7,8 @@ require 'renc' 
     | 
|
| 
       7 
7 
     | 
    
         
             
            # with your gem easier. You can also use a different console, if you like.
         
     | 
| 
       8 
8 
     | 
    
         | 
| 
       9 
9 
     | 
    
         
             
            # (If you use this, don't forget to add pry to your Gemfile!)
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
             
     | 
| 
      
 10 
     | 
    
         
            +
            require 'pry'
         
     | 
| 
      
 11 
     | 
    
         
            +
            Pry.start
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
            require 'irb'
         
     | 
| 
       14 
     | 
    
         
            -
            IRB.start
         
     | 
| 
      
 13 
     | 
    
         
            +
            # require 'irb'
         
     | 
| 
      
 14 
     | 
    
         
            +
            # IRB.start
         
     | 
    
        data/lib/renc.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ require 'renc/version' 
     | 
|
| 
       2 
2 
     | 
    
         | 
| 
       3 
3 
     | 
    
         
             
            # namespace
         
     | 
| 
       4 
4 
     | 
    
         
             
            module Renc
         
     | 
| 
       5 
     | 
    
         
            -
              def  
     | 
| 
      
 5 
     | 
    
         
            +
              def renc(obj, encoding = Encoding::UTF_8)
         
     | 
| 
       6 
6 
     | 
    
         
             
                case obj
         
     | 
| 
       7 
7 
     | 
    
         
             
                when String then obj.encode(encoding)
         
     | 
| 
       8 
8 
     | 
    
         
             
                when Hash   then enc_hash(obj, encoding)
         
     | 
| 
         @@ -11,16 +11,20 @@ module Renc 
     | 
|
| 
       11 
11 
     | 
    
         
             
                end
         
     | 
| 
       12 
12 
     | 
    
         
             
              end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
               
     | 
| 
      
 14 
     | 
    
         
            +
              extend Gem::Deprecate
         
     | 
| 
      
 15 
     | 
    
         
            +
              alias enc renc
         
     | 
| 
      
 16 
     | 
    
         
            +
              deprecate :enc, :renc, 2016, 3
         
     | 
| 
       15 
17 
     | 
    
         | 
| 
       16 
     | 
    
         
            -
               
     | 
| 
      
 18 
     | 
    
         
            +
              private
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
              def enc_hash(obj, encoding)
         
     | 
| 
       17 
21 
     | 
    
         
             
                obj.each_with_object({}) do |args, h|
         
     | 
| 
       18 
22 
     | 
    
         
             
                  key, val = args
         
     | 
| 
       19 
     | 
    
         
            -
                  h[key] =  
     | 
| 
      
 23 
     | 
    
         
            +
                  h[key] = renc(val, encoding)
         
     | 
| 
       20 
24 
     | 
    
         
             
                end
         
     | 
| 
       21 
25 
     | 
    
         
             
              end
         
     | 
| 
       22 
26 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
              def  
     | 
| 
       24 
     | 
    
         
            -
                obj.map { |val|  
     | 
| 
      
 27 
     | 
    
         
            +
              def enc_array(obj, encoding)
         
     | 
| 
      
 28 
     | 
    
         
            +
                obj.map { |val| renc(val, encoding) }
         
     | 
| 
       25 
29 
     | 
    
         
             
              end
         
     | 
| 
       26 
30 
     | 
    
         
             
            end
         
     | 
    
        data/lib/renc/version.rb
    CHANGED
    
    
    
        data/renc.gemspec
    CHANGED
    
    | 
         @@ -9,6 +9,8 @@ Gem::Specification.new do |spec| 
     | 
|
| 
       9 
9 
     | 
    
         
             
              spec.authors       = ['k-ta-yamada']
         
     | 
| 
       10 
10 
     | 
    
         
             
              spec.email         = ['key.luvless@gmail.com']
         
     | 
| 
       11 
11 
     | 
    
         | 
| 
      
 12 
     | 
    
         
            +
              spec.required_ruby_version = '>= 2.2.4'
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
       12 
14 
     | 
    
         
             
              spec.summary       = 'recurse encoding for Hash and Array.'
         
     | 
| 
       13 
15 
     | 
    
         
             
              spec.description   = 'recurse encoding for Hash and Array.'
         
     | 
| 
       14 
16 
     | 
    
         
             
              spec.homepage      = 'https://github.com/k-ta-yamada/renc'
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,14 +1,14 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: renc
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - k-ta-yamada
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire: 
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date: 2016-02- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2016-02-27 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: bundler
         
     | 
| 
         @@ -131,6 +131,8 @@ extra_rdoc_files: [] 
     | 
|
| 
       131 
131 
     | 
    
         
             
            files:
         
     | 
| 
       132 
132 
     | 
    
         
             
            - ".gitignore"
         
     | 
| 
       133 
133 
     | 
    
         
             
            - ".rspec"
         
     | 
| 
      
 134 
     | 
    
         
            +
            - ".rubocop.yml"
         
     | 
| 
      
 135 
     | 
    
         
            +
            - ".rubocop_todo.yml"
         
     | 
| 
       134 
136 
     | 
    
         
             
            - ".travis.yml"
         
     | 
| 
       135 
137 
     | 
    
         
             
            - CAHNGELOG.md
         
     | 
| 
       136 
138 
     | 
    
         
             
            - CODE_OF_CONDUCT.md
         
     | 
| 
         @@ -155,7 +157,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       155 
157 
     | 
    
         
             
              requirements:
         
     | 
| 
       156 
158 
     | 
    
         
             
              - - ">="
         
     | 
| 
       157 
159 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       158 
     | 
    
         
            -
                  version:  
     | 
| 
      
 160 
     | 
    
         
            +
                  version: 2.2.4
         
     | 
| 
       159 
161 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       160 
162 
     | 
    
         
             
              requirements:
         
     | 
| 
       161 
163 
     | 
    
         
             
              - - ">="
         
     |