ruby-development-toolbox 1.0.1 → 1.0.2

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: 8ba6feb404e796725892b588f2269c5d450ba5d2
4
- data.tar.gz: 1c0aea5470e67d94e9a5da5d7ea3fa18b17e8896
3
+ metadata.gz: 284d3506ff00d877e252ea2790a4c86b5c1472ab
4
+ data.tar.gz: b4da771c9a532af0f0aee7dd83244fa09ae82cfc
5
5
  SHA512:
6
- metadata.gz: 7648624640b0e2f9d428a0c6c4583b5e702c88b53f39b89f4c2aba059cb4b1934c80ff018d92457c8f1bc0992f7f64e924b1fffb51b847e2f61c5a6b88b884dd
7
- data.tar.gz: 07c7687f492bf8672615d2bd0739c8ad11f5ecadf4b71b9e0be7473bf0fb741d4c71808d71db94f4ecb9d252ed2ad42b65cf61fff08a867e6b1d334ab8dd7098
6
+ metadata.gz: ae34c151e75d6c4003d5e28c0bf46c5ec240770576e79285e72871c72405dcdbefd1fb2a26caaa67781bdf8895a83fe3ec084e57b900c400e8e985551deec128
7
+ data.tar.gz: 377d94cc09937bf18ebdabd6ba82f05fadfd8f07f38d5c2d55886e8b6c91c4863546e1281bd266953b39d1833e826654496339e01b0807ad1120eb347131108c
data/README.md CHANGED
@@ -2,15 +2,41 @@
2
2
 
3
3
  A collection of useful utilities and libraries for Ruby development (not Rails)
4
4
 
5
- ## Contributing to ruby-development-toolbox
6
-
7
- * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
8
- * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
9
- * Fork the project.
10
- * Start a feature/bugfix branch.
11
- * Commit and push until you are happy with your contribution.
12
- * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
- * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
5
+ ## Installation
6
+
7
+ The toolset can be installed via:
8
+
9
+ gem install ruby-development-toolbox
10
+
11
+ ## Usage
12
+
13
+ Most modules in the toolbox extend on base Ruby classes to provide additional (or missing) features. For example, the `toolbox/boolean` module provides a `to_bool` operation to:
14
+
15
+ 1. `String`
16
+ 2. `FalseClass`
17
+ 3. `TrueClass`
18
+ 4. and `NilClass`
19
+
20
+ This is to support operations like the following:
21
+
22
+ $ irb
23
+ 2.0.0-p353 :001 > require 'toolbox/boolean'
24
+ => true
25
+ 2.0.0-p353 :002 > "true".to_bool
26
+ => true
27
+ 2.0.0-p353 :003 > "TRUE".to_bool
28
+ => true
29
+ 2.0.0-p353 :004 > "False".to_bool
30
+ => false
31
+ 2.0.0-p353 :005 > false.to_bool
32
+ => false
33
+ 2.0.0-p353 :006 > nil.to_bool
34
+ => nil
35
+
36
+
37
+ ## Documentation
38
+
39
+ The projects homepage can be found [here](https://github.com/gradeawarrior/ruby-development-toolbox). You can also refer to the [Rubydoc YARD Server](http://rubydoc.info/github/gradeawarrior/ruby-development-toolbox/frames)
14
40
 
15
41
  # Development
16
42
 
@@ -54,6 +80,16 @@ At last, it's time to ship it! Make sure you have everything committed and pushe
54
80
 
55
81
  $ rake release
56
82
 
83
+ # Contributing to ruby-development-toolbox
84
+
85
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
86
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
87
+ * Fork the project.
88
+ * Start a feature/bugfix branch.
89
+ * Commit and push until you are happy with your contribution.
90
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
91
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
92
+
57
93
  # Copyright
58
94
 
59
95
  Copyright (c) 2014 Peter Salas. See LICENSE.txt for
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.2
@@ -1,5 +1,6 @@
1
1
  ##
2
- # Extending String function to be able to convert a String 'true' or 'false' to a boolean true/false
2
+ # Extending String function to be able to convert a String 'true' or 'false' to a boolean true/false.
3
+ # See the Boolean module for usage
3
4
  #
4
5
  class String
5
6
  def to_bool
@@ -8,7 +9,8 @@ class String
8
9
  end
9
10
 
10
11
  ##
11
- # Implementing to_bool operation that returns self
12
+ # Implementing to_bool operation that returns self.
13
+ # See the Boolean module for usage
12
14
  #
13
15
  class TrueClass
14
16
  def to_bool
@@ -17,7 +19,8 @@ class TrueClass
17
19
  end
18
20
 
19
21
  ##
20
- # Implementing to_bool operation that returns self
22
+ # Implementing to_bool operation that returns self.
23
+ # See the Boolean module for usage
21
24
  #
22
25
  class FalseClass
23
26
  def to_bool
@@ -26,10 +29,42 @@ class FalseClass
26
29
  end
27
30
 
28
31
  ##
29
- # Implementing to_bool operation that returns self
32
+ # Implementing to_bool operation that returns self.
33
+ # See the Boolean module for usage
30
34
  #
31
35
  class NilClass
32
36
  def to_bool
33
37
  self
34
38
  end
39
+ end
40
+
41
+ ##
42
+ # The main application of the Boolean module is to
43
+ # support reading boolean values from a String (e.g.
44
+ # while reading a configuration value) and having the
45
+ # ability to convert it back to a boolean true/false
46
+ # for easier evaluation in your Ruby code
47
+ #
48
+ # == Usage
49
+ #
50
+ # Working with Boolean module can be very simple, for example:
51
+ #
52
+ # require 'toolbox/boolean'
53
+ #
54
+ # list_of_values = [
55
+ # 'true',
56
+ # 'True',
57
+ # 'TRUE',
58
+ # 'false',
59
+ # 'False',
60
+ # 'FALSE',
61
+ # nil,
62
+ # ]
63
+ #
64
+ # list_of_values.each do |string|
65
+ # puts "This evaluated to true" if string.to_bool
66
+ # puts "This evaluated to false or was nil" unless string.to_bool
67
+ # end
68
+ #
69
+ module Boolean
35
70
  end
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "ruby-development-toolbox"
8
- s.version = "1.0.1"
8
+ s.version = "1.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Peter Salas"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-development-toolbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Salas