powerpack 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: f00f072d1cdb57a2f839f9765d9a20febde24d46
4
- data.tar.gz: 9b83e641c01d845078ef7c20d0c1471c1ffafc12
3
+ metadata.gz: 4b1dee25575ff6e8b6dc5b84b6a6a2f000389e00
4
+ data.tar.gz: 4eed3f28b561507e70a1828a6fcc74cf6e8a4c22
5
5
  SHA512:
6
- metadata.gz: d5eb9328f399bb63be65fa5863744a0641025b0a89d24a3f46a9a1a2d6a7de6895b009502020f04337e58f513628723226760c6a873f95a34340921e52e2ffad
7
- data.tar.gz: 5a49681a9f2de6f06eb95f09abb9da48baa10cf31da30af55e79cb49ea3f75d46f8b3b3ee02e25d545fcac2630853240282866349cdae7be52a03954f798a4d2
6
+ metadata.gz: 41e393fc5b3b067fd7551533d13c128f5357387485417812eaa318c3f96feea99f5ee15318d7e74e633540adc07dbf944d3d4a9af78274c18250cf83cc4e4541
7
+ data.tar.gz: a68471ecde73ac4a51273971bf936c7621950d3e27d8ced65786153397d9f7104236e2f1840d63c93d429e71fd58e9041f8419826a57f6e61872ad3b59b4e7e6
data/README.md CHANGED
@@ -1,6 +1,9 @@
1
+ [![Gem Version](https://badge.fury.io/rb/powerpack.png)](http://badge.fury.io/rb/powerpack)
2
+ [![Build Status](https://travis-ci.org/bbatsov/powerpack.png?branch=master)](https://travis-ci.org/bbatsov/powerpack)
3
+
1
4
  # Powerpack
2
5
 
3
- Powerpack offers some useful extensions to the standard Ruby classes (kind of like `ActiveSupport`).
6
+ Powerpack offers some useful extensions to the standard Ruby classes (kind of like `ActiveSupport`, but less ambitious).
4
7
 
5
8
  ## Installation
6
9
 
@@ -16,6 +19,21 @@ Or install it yourself as:
16
19
 
17
20
  $ gem install powerpack
18
21
 
22
+ ## Extensions
23
+
24
+ * [Hash](http://rdoc.info/github/bbatsov/powerpack/Hash)
25
+ ** [#symbolize_keys](http://rdoc.info/github/bbatsov/powerpack/Hash#symbolize_keys-instance_method)
26
+ * [String](http://rdoc.info/github/bbatsov/powerpack/String)
27
+ ** [#blank?](http://rdoc.info/github/bbatsov/powerpack/String#blank?-instance_method)
28
+ ** [#format](http://rdoc.info/github/bbatsov/powerpack/String#format-instance_method)
29
+ ** [#strip_indent](http://rdoc.info/github/bbatsov/powerpack/String#strip_indent-instance_method)
30
+ ** [#strip_margin](http://rdoc.info/github/bbatsov/powerpack/String#strip_margin-instance_method)
31
+
32
+ ## Documentation
33
+
34
+ A listing of the extensions provided by Powerpack is available
35
+ [here](http://rdoc.info/github/bbatsov/powerpack).
36
+
19
37
  ## Usage
20
38
 
21
39
  To load the entire `powerpack` do:
@@ -1,3 +1,4 @@
1
+ require_relative 'string/blank'
1
2
  require_relative 'string/format'
2
3
  require_relative 'string/strip_indent'
3
4
  require_relative 'string/strip_margin'
@@ -0,0 +1,9 @@
1
+ unless String.method_defined? :blank?
2
+ class String
3
+ # Returns true for empty strings and string with
4
+ # only whitespace in them.
5
+ def blank?
6
+ self.empty? || self.strip.empty?
7
+ end
8
+ end
9
+ end
@@ -1,3 +1,3 @@
1
1
  module Powerpack
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -0,0 +1,15 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'String#blank?' do
4
+ it 'returns true for an empty string' do
5
+ expect(''.blank?).to be_true
6
+ end
7
+
8
+ it 'returns true for a string with only whitespace in it' do
9
+ expect(' '.blank?).to be_true
10
+ end
11
+
12
+ it 'returns false for a string with non-whitespace chars in it' do
13
+ expect(' test'.blank?).to be_false
14
+ end
15
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: powerpack
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
  - Bozhidar Batsov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-12 00:00:00.000000000 Z
11
+ date: 2013-08-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -84,12 +84,14 @@ files:
84
84
  - lib/powerpack/hash.rb
85
85
  - lib/powerpack/hash/symbolize_keys.rb
86
86
  - lib/powerpack/string.rb
87
+ - lib/powerpack/string/blank.rb
87
88
  - lib/powerpack/string/format.rb
88
89
  - lib/powerpack/string/strip_indent.rb
89
90
  - lib/powerpack/string/strip_margin.rb
90
91
  - lib/powerpack/version.rb
91
92
  - powerpack.gemspec
92
93
  - spec/powerpack/hash/symbolize_keys_spec.rb
94
+ - spec/powerpack/string/blank_spec.rb
93
95
  - spec/powerpack/string/format_spec.rb
94
96
  - spec/powerpack/string/strip_indent_spec.rb
95
97
  - spec/powerpack/string/strip_margin_spec.rb
@@ -120,6 +122,7 @@ specification_version: 4
120
122
  summary: A few useful extensions to core Ruby classes.
121
123
  test_files:
122
124
  - spec/powerpack/hash/symbolize_keys_spec.rb
125
+ - spec/powerpack/string/blank_spec.rb
123
126
  - spec/powerpack/string/format_spec.rb
124
127
  - spec/powerpack/string/strip_indent_spec.rb
125
128
  - spec/powerpack/string/strip_margin_spec.rb