lab42_core 0.0.1 → 0.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0b1b53a7117e5bcc77392e003507108f2d614304
4
- data.tar.gz: 124320608f777e41b30a1e9f4febe25d022fd3f4
3
+ metadata.gz: e11f89610f33fe0d3b0adaeeeb51aec8f6d1f3b8
4
+ data.tar.gz: 864f519dc4f855c8601b26ed967169f5b34188d6
5
5
  SHA512:
6
- metadata.gz: 434596f773636fe36929511e5521bc2cc29cb56444f683a825418eeeb23892edc218c30dac4f707085a43fafe09e174ff7d329483e14113a0cd42414102e8179
7
- data.tar.gz: 05c3669197233517c10889d3e4a989b307812e74d60dd27b082b44fb0f0611cbe2e641a851aae3389fc7804ba6d69027499d798b7fd774a861ad95981b85089b
6
+ metadata.gz: 0d638794dbc237460697cafe85360f7b6cdc91703134b106a99bd9356891408e81cc6cbd168f7f8e92ca9cf1dba70224230724729391dd130157a3d23408f5bf
7
+ data.tar.gz: df554a6854136498b13958b88b2adb1185aa95dee550206e67099d7a97ecceba9623a0a2e1b3d367f4717d2fb9d76acf17cbaf212523bbbabcdcd93d89ab3316
data/README.md CHANGED
@@ -5,7 +5,7 @@ Ruby Core Module Extensions (in the spirit of lab419/core)
5
5
  ## Dir
6
6
 
7
7
  ```ruby
8
- Dir.walk "**/*" do | partial_path, full_path |
8
+ Dir.files "**/*" do | partial_path, full_path |
9
9
  end
10
10
  ```
11
11
 
@@ -15,3 +15,9 @@ Ruby Core Module Extensions (in the spirit of lab419/core)
15
15
  enum.grep2 expr # ===>
16
16
  enum.partition{ |ele| expr === ele }
17
17
  ```
18
+
19
+ ## Hash
20
+
21
+ ```ruby
22
+ {a: 42, b: 43}.only :a, :c # ===> {a: 42}
23
+ ```
@@ -0,0 +1,11 @@
1
+ class Hash
2
+ def only *args
3
+ args.inject Hash.new do | r, k |
4
+ if has_key? k
5
+ r.merge k => self[k]
6
+ else
7
+ r
8
+ end
9
+ end
10
+ end
11
+ end # class Hash
@@ -1,5 +1,5 @@
1
1
  module Lab42
2
2
  module Core
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end # module Core
5
5
  end # module Lab42
data/lib/lab42/core.rb CHANGED
@@ -1,2 +1,3 @@
1
1
  require 'lab42/core/dir'
2
2
  require 'lab42/core/enumerable'
3
+ require 'lab42/core/hash'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lab42_core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Dober
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-31 00:00:00.000000000 Z
11
+ date: 2013-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -47,6 +47,7 @@ files:
47
47
  - lib/lab42/core.rb
48
48
  - lib/lab42/core/enumerable.rb
49
49
  - lib/lab42/core/version.rb
50
+ - lib/lab42/core/hash.rb
50
51
  - lib/lab42/core/dir.rb
51
52
  - LICENSE
52
53
  - README.md