hashy 0.0.2 → 0.0.3

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: cb750c036e9df13929939a4fa00ee055a9ab616a
4
- data.tar.gz: f153ba48996550d3c98872db14f958efb03f1b0a
3
+ metadata.gz: 2712b2ae12b724e4116870fb8f25292861a4407f
4
+ data.tar.gz: 7826a8f3e1dedfb868237517c172607df03af70e
5
5
  SHA512:
6
- metadata.gz: 2723b5cd96eddc110ce14cbb0f47e30b9ea28c16df44d8c96696b6e44c304c961b98c35d51e8eb2566f043aaa3357de7811486009969116af4d461e1bf03fdac
7
- data.tar.gz: bca0c634adc2eaffc619650198d62ac359a52a79a6566a319fc73e12124fdd96ff7a6c06aee635ffe51d475c1d021d7f0344a01095d79f604e71829f207b430f
6
+ metadata.gz: d2a7f1d5a9a78ddaf8e4bd153526353a0dc4ceea54008cae502bc22782a3a5383cb904fca496193b2fb6db2ea57a588137bf52d62188896293236738a319b4c3
7
+ data.tar.gz: a5d38f4747043c9b46ad82fa5e31a3432ee0bcb0c9c44537bb9701215785605e7634ff11fa9524e7f9b2087179292ca7d8ee1a96733ee4083abb3dd95d797581
@@ -0,0 +1,7 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.1.0
4
+ - 2.0.0
5
+ - 1.9.3
6
+ - jruby-19mode
7
+ - rbx-19mode
@@ -1,4 +1,4 @@
1
- Copyright (c) 2013 Shannon Skipper
1
+ Copyright (c) 2014 Shannon Skipper
2
2
 
3
3
  MIT License
4
4
 
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Hashy
2
2
 
3
- A Ruby gem implementing a few proposed methods for the Hash class: Hash#map_pair, Hash#map_key and Hash#map_value.
3
+ [![Build Status](https://travis-ci.org/havenwood/hashy.png?branch=master)](https://travis-ci.org/havenwood/hashy)
4
+
5
+ A trivial implementation of three new Hash methods: map_pair, map_key & map_value. It's [been proposed](http://www.ruby-forum.com/topic/4410595) that these methods be added to the Ruby language. They're each just [one-liners in Ruby](https://github.com/havenwood/hashy/blob/master/lib/hashy.rb) but it seems they're quite handy.
4
6
 
5
7
  ## Installation
6
8
 
@@ -12,29 +14,24 @@ gem install hashy
12
14
 
13
15
  ```ruby
14
16
  require 'hashy'
15
- ```
16
-
17
- ## Examples
18
17
 
19
- ```ruby
20
18
  hash = { aim: true }
21
19
  #=> {:aim=>true}
22
20
 
23
21
  hash.map_pair { |k, v| [k.to_s, v.to_s] }
24
22
  #=> {"aim"=>"true"}
25
23
 
26
- hash.map_key &:to_s
24
+ hash.map_key(&:to_s)
27
25
  #=> {"aim"=>true}
28
26
 
29
- hash.map_value &:to_s
27
+ hash.map_value(&:to_s)
30
28
  #=> {:aim=>"true"}
31
29
  ```
32
30
 
33
31
  ## Credits
34
32
 
35
- - dsisnero's [initial post on ruby-core](http://www.ruby-forum.com/topic/4410595#new)
33
+ - dsisnero's [initial post on ruby-core](http://www.ruby-forum.com/topic/4410595)
36
34
  - nobu's suggestion of appropriate method names and making a gem
37
35
  - heftig's refactoring of the code
38
36
 
39
37
  Thanks all!
40
-
@@ -8,16 +8,12 @@ Gem::Specification.new do |spec|
8
8
  spec.version = Hashy::VERSION
9
9
  spec.authors = ['Shannon Skipper']
10
10
  spec.email = ['shannonskipper@gmail.com']
11
- spec.description = %q{A Ruby gem implementing additional proposed methods for the Hash class: #map_pair, #map_key, #map_value}
12
- spec.summary = %q{Hash#map_pair, Hash#map_key, and Hash#map_value}
11
+ spec.description = %q{Three proposed new methods for Hash: map_pair, map_key, and map_value.}
12
+ spec.summary = %q{A trivial implementation of three proposed methods for the Hash class: map_pair, map_key and map_value.}
13
13
  spec.homepage = 'https://github.com/havenwood/hashy'
14
14
  spec.license = 'MIT'
15
-
16
15
  spec.files = `git ls-files`.split($/)
17
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
16
+ spec.test_files = spec.files.grep(%r{^(test)/})
19
17
  spec.require_paths = ['lib']
20
-
21
- spec.signing_key = '/Users/shannonskipper/.gem/private/gem-private_key.pem'
22
- spec.cert_chain = ['/Users/shannonskipper/.gem/private/gem-public_cert.pem']
18
+ spec.add_development_dependency 'rake', '~> 10.3'
23
19
  end
@@ -4,16 +4,12 @@ class Hash
4
4
  def map_pair &block
5
5
  Hash[map &block]
6
6
  end
7
-
7
+
8
8
  def map_key
9
- each_pair.with_object({}) do |(key, value), result|
10
- result[yield key] = value
11
- end
9
+ each_with_object({}) { |(k, v), h| h[yield(k)] = v }
12
10
  end
13
-
11
+
14
12
  def map_value
15
- each_pair.with_object({}) do |(key, value), result|
16
- result[key] = yield value
17
- end
13
+ each_with_object({}) { |(k, v), h| h[k] = yield(v) }
18
14
  end
19
15
  end
@@ -1,3 +1,3 @@
1
1
  class Hashy
2
- VERSION = '0.0.2'
2
+ VERSION = '0.0.3'
3
3
  end
@@ -1,6 +1,8 @@
1
+ $LOAD_PATH.unshift File.expand_path(File.dirname(__FILE__), '../lib')
2
+ require 'hashy'
3
+ require 'hashy/version'
1
4
  require 'minitest/autorun'
2
5
  require 'minitest/pride'
3
- require 'hashy'
4
6
 
5
7
  describe Hash do
6
8
  before do
metadata CHANGED
@@ -1,46 +1,38 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hashy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shannon Skipper
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDijCCAnKgAwIBAgIBATANBgkqhkiG9w0BAQUFADBFMRcwFQYDVQQDDA5zaGFu
14
- bm9uc2tpcHBlcjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQB
15
- GRYDY29tMB4XDTEzMDIwMjIyMjQ1MFoXDTE0MDIwMjIyMjQ1MFowRTEXMBUGA1UE
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R/xF1pa52F7w==
32
- -----END CERTIFICATE-----
33
- date: 2013-03-05 00:00:00.000000000 Z
34
- dependencies: []
35
- description: 'A Ruby gem implementing additional proposed methods for the Hash class:
36
- #map_pair, #map_key, #map_value'
10
+ cert_chain: []
11
+ date: 2014-08-21 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rake
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '10.3'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '10.3'
27
+ description: 'Three proposed new methods for Hash: map_pair, map_key, and map_value.'
37
28
  email:
38
29
  - shannonskipper@gmail.com
39
30
  executables: []
40
31
  extensions: []
41
32
  extra_rdoc_files: []
42
33
  files:
43
- - .gitignore
34
+ - ".gitignore"
35
+ - ".travis.yml"
44
36
  - Gemfile
45
37
  - LICENSE.txt
46
38
  - README.md
@@ -59,20 +51,21 @@ require_paths:
59
51
  - lib
60
52
  required_ruby_version: !ruby/object:Gem::Requirement
61
53
  requirements:
62
- - - '>='
54
+ - - ">="
63
55
  - !ruby/object:Gem::Version
64
56
  version: '0'
65
57
  required_rubygems_version: !ruby/object:Gem::Requirement
66
58
  requirements:
67
- - - '>='
59
+ - - ">="
68
60
  - !ruby/object:Gem::Version
69
61
  version: '0'
70
62
  requirements: []
71
63
  rubyforge_project:
72
- rubygems_version: 2.0.0
64
+ rubygems_version: 2.4.1
73
65
  signing_key:
74
66
  specification_version: 4
75
- summary: Hash#map_pair, Hash#map_key, and Hash#map_value
67
+ summary: 'A trivial implementation of three proposed methods for the Hash class: map_pair,
68
+ map_key and map_value.'
76
69
  test_files:
77
70
  - test/test_hashy.rb
78
71
  has_rdoc:
@@ -1,3 +0,0 @@
1
- �`*)!�����45������q�O[(�BjT��К?�;�z�������94m�%�K(���{z�P(,�}�����hEG�/��.
2
- �7 �V]p4�^��,���*9B�x���k�� Y?#DD��u�,f�F�W1�� ��N�(��j�=���� x2Ӧ.{�ji� ��ؑPw�G�����,3"��$ѳ]u����uq� ��
3
- <�x�X�Q&i�8Nc���,�r�*�a�d`��O�'�׏b2�?
data.tar.gz.sig DELETED
@@ -1 +0,0 @@
1
- C�����Z����FL��F��DM��U l��=��Qz�6<| ��#D�IH�X�M�ϲ)
metadata.gz.sig DELETED
Binary file