hesh 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
  SHA256:
3
- metadata.gz: 51993aff5492c29105b73ec622942f5f827da21e1c8f2c8bbebf0c4c52707878
4
- data.tar.gz: 3a7796f89cc9806cb576f0120c67ec86560587ea12d6b55040ab63538c35bbcb
3
+ metadata.gz: 991c9c276b3e5437074c7b25be12c1eb74851148d7223adcb0d7224d022cb302
4
+ data.tar.gz: eab09ad0a69764fbd8222e7a6e933442a7ba7dee514a20fc26b108cce05ba40a
5
5
  SHA512:
6
- metadata.gz: b096afaddb9863fbb9cb08feeb37c920a1f00e41b3931672a3cadb1e26a19278e1ee1c9653063afc59e31a3bc845eea881c6be9c49b86a87442cac5fce814149
7
- data.tar.gz: bd4d3db10f5aff1754fa2821b096973e7c9ee07cfde296cf1d1a9a697076e8be6e934fe9d21edc559820ca0dd11c91c1d1c45c15dc240b2262dc63eb6c832eb6
6
+ metadata.gz: b9da29f51a4dbf326e5dbbb40b65749bbf509af484630c9b30445a4b805403ceafd102611d0db8e209bdac170cddf9539eefbf5fda738ed919b3c6d0c04b082b
7
+ data.tar.gz: 516ab4b53d42ecf349696e49bfdb01ac893d247210260f8e9c535c546488c78a6a69601ebc25a4e12c019087199d193890df6baeeecd180a6110c179627168a3
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- hesh (0.0.2)
4
+ hesh (0.0.3)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -7,6 +7,9 @@ Hesh makes Hashes. That's it for now. I may come up with something more clever l
7
7
  Run down of the functions:
8
8
 
9
9
  ```ruby
10
+ # Makes a new Hash with a function used to determine the default value
11
+ Hesh.of { [] } # == Hash.new { |h,k| h[k] = fn.call(h, k) }
12
+
10
13
  # Makes a new Hash with default values of a new array
11
14
  Hesh.of_array # == Hash.new { |h,k| h[k] = [] }
12
15
 
data/lib/hesh.rb CHANGED
@@ -13,6 +13,17 @@ class Hesh
13
13
  end
14
14
 
15
15
  class << self
16
+ # Creates a Hash of something, I'm not sure what, you tell me!
17
+ #
18
+ # @param &fn [Proc]
19
+ # Function for default value of the hash, yielding the hash and
20
+ # key if ya need them
21
+ #
22
+ # @return [Hash[Any, Any]]
23
+ def of(&fn)
24
+ Hash.new { |h, k| h[k] = fn.call(h, k) }
25
+ end
26
+
16
27
  # Creates a Hash of arrays
17
28
  #
18
29
  # @return [Hash[Any, Array]]
data/lib/hesh/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Hesh
2
- VERSION = "0.0.2"
2
+ VERSION = "0.0.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hesh
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
  - Brandon Weaver