extends_bool 0.1.0 → 0.2.1

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
  SHA256:
3
- metadata.gz: cfce7acc32b688886ed36f3b036947e1e44e84fb5257fdae6023949ad44460b0
4
- data.tar.gz: 8ee3e13cabae336b139d14e1e4933a0bbead9addeecde9b24e5062bfef39f54f
3
+ metadata.gz: 809f0d7fed10f6fa63b7b10d248358b2b34a313915ec7c219112da59194facb3
4
+ data.tar.gz: 17d7fb0f4d949f772d86730fb23fa53b416c86528b7980719a11abdf48751b2e
5
5
  SHA512:
6
- metadata.gz: 5038e9dc4e3f1db7587b9adff9426fe85c406eddda9ea51367771c6a61e2813f0d7e84bf3aa578c8ddd7a3c61417df918a75ec1fe965019840e79e0d522fc324
7
- data.tar.gz: 26a0d378f1c021c7c92674029253d43771766c4340e2de78c368d1858b2f6c3ef4c51fb63f8484ede2f217d13c663667e328394be7cfcc56a5db83b94a113961
6
+ metadata.gz: e3087eebefe22f1fd5c005060da0ecc186cdbee15bb3f98bd180db1512ecfcec542db6d6c9b624eb6c8eb7ddb6f7ec01cd8f6e7625d125219e740616ffa3c2d3
7
+ data.tar.gz: 92517ac8715861dcbdc4c7db11f807363a0fafd25cd21317d9d5153d96df76b8a31aabdb8d52a0dc794df4e7a23c7f1bae656cb1df046a5754a538ba0bffabf2
@@ -1,5 +1,14 @@
1
- sudo: false
2
1
  language: ruby
3
- rvm:
2
+
3
+ rvm:
4
4
  - 2.5.1
5
- before_install: gem install bundler -v 1.16.2
5
+
6
+ notifications:
7
+ email:
8
+ - andreluizleoni@gmail.com
9
+
10
+ before_install:
11
+ - gem install bundler -v 1.16.2
12
+
13
+ script:
14
+ - bundle exec rspec
@@ -0,0 +1,25 @@
1
+ # Changelog
2
+
3
+ ## Version 0.2.1
4
+
5
+ * Update doc
6
+
7
+ ## Version 0.2.0
8
+
9
+ * Added the behaviour to ignore case_sensitive to string values, when "f", "false", "off".
10
+ * Added the alias `.to_b`, `.to_boolean` to the default `.to_bool`.
11
+
12
+ ## Version 0.1.0
13
+
14
+ First version. Created the `to_bool` behaviour to the follow classes:
15
+
16
+ * String
17
+ * Integer
18
+ * Float
19
+ * Array
20
+ * Hash
21
+ * TrueClass
22
+ * FalseClass
23
+ * NilClass
24
+
25
+ False values: `[nil, false, 0, 0.0, "", "0", "f", "F", "false", "FALSE", "off", "OFF", [], {}]`
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- extends_bool (0.1.0)
4
+ extends_bool (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -32,4 +32,4 @@ DEPENDENCIES
32
32
  rspec (~> 3.0)
33
33
 
34
34
  BUNDLED WITH
35
- 1.16.2
35
+ 1.16.6
data/README.md CHANGED
@@ -1,8 +1,18 @@
1
1
  # ExtendsBool
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/extends_bool`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Maintainability](https://api.codeclimate.com/v1/badges/14edfa60e47e8d5dce9e/maintainability)](https://codeclimate.com/github/andreleoni/extends_bool/maintainability)
4
+ [![Build Status](https://travis-ci.com/andreleoni/extends_bool.svg?branch=master)](https://travis-ci.com/andreleoni/extends_bool)
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ Add `.to_bool` behaviour to the follow classes:
7
+
8
+ * String
9
+ * Integer
10
+ * Float
11
+ * Array
12
+ * Hash
13
+ * TrueClass
14
+ * FalseClass
15
+ * NilClass
6
16
 
7
17
  ## Installation
8
18
 
@@ -22,13 +32,7 @@ Or install it yourself as:
22
32
 
23
33
  ## Usage
24
34
 
25
- TODO: Write usage instructions here
26
-
27
- ## Development
28
-
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
-
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
35
+ Simple, if the variable have any of `[nil, false, 0, 0.0, "", "0", "f", "F", "false", "FALSE", "off", "OFF", [], {}]` values, will return `false`, else, returns `true`.
32
36
 
33
37
  ## Contributing
34
38
 
@@ -8,8 +8,8 @@ Gem::Specification.new do |spec|
8
8
  spec.version = ExtendsBool::VERSION
9
9
  spec.authors = ["André Leoni"]
10
10
  spec.email = ["andreluizleoni@gmail.com"]
11
- spec.summary = %q{Adds `.to_bool` behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.}
12
- spec.description = %q{Adds `.to_bool` behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.}
11
+ spec.summary = %q{Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.}
12
+ spec.description = %q{Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass, FalseClass and NilClass.}
13
13
  spec.homepage = "https://github.com/andreleoni/extends_bool"
14
14
  spec.license = "MIT"
15
15
 
@@ -22,6 +22,12 @@ Gem::Specification.new do |spec|
22
22
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23
23
  spec.require_paths = ["lib"]
24
24
 
25
+ spec.metadata = {
26
+ "changelog_uri" => "https://github.com/andreleoni/extends_bool/blob/master/CHANGELOG.md",
27
+ "homepage_uri" => "https://github.com/andreleoni/extends_bool",
28
+ "source_code_uri" => "https://github.com/andreleoni/extends_bool"
29
+ }
30
+
25
31
  spec.add_development_dependency "bundler", "~> 1.16"
26
32
  spec.add_development_dependency "rake", "~> 10.0"
27
33
  spec.add_development_dependency "rspec", "~> 3.0"
@@ -1,13 +1,18 @@
1
1
  require "extends_bool/version"
2
2
 
3
3
  module ExtendsBool
4
- FALSE_VALUES = [nil, false, 0, 0.0, "", "0", "f", "F", "false", "FALSE", "off", "OFF", [], {}]
4
+ FALSE_VALUES = [nil, false, 0, 0.0, "", "0", "f", "false", "off", [], {}]
5
5
 
6
6
  # Returns a boolean value, according the object value.
7
7
  #
8
8
  def to_bool
9
+ value = self
10
+ value.downcase! if value.is_a?(String)
9
11
  !FALSE_VALUES.include?(self)
10
12
  end
13
+
14
+ alias_method :to_b, :to_bool
15
+ alias_method :to_boolean, :to_bool
11
16
  end
12
17
 
13
18
  # Add the to_bool behaviour to all the follow classes:
@@ -1,3 +1,3 @@
1
1
  module ExtendsBool
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: extends_bool
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - André Leoni
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-11-19 00:00:00.000000000 Z
11
+ date: 2018-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,7 +52,7 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
- description: Adds `.to_bool` behaviour to String, Integer, Float, Array, Hash, TrueClass,
55
+ description: Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass,
56
56
  FalseClass and NilClass.
57
57
  email:
58
58
  - andreluizleoni@gmail.com
@@ -63,6 +63,7 @@ files:
63
63
  - ".gitignore"
64
64
  - ".rspec"
65
65
  - ".travis.yml"
66
+ - CHANGELOG.md
66
67
  - CODE_OF_CONDUCT.md
67
68
  - Gemfile
68
69
  - Gemfile.lock
@@ -77,7 +78,10 @@ files:
77
78
  homepage: https://github.com/andreleoni/extends_bool
78
79
  licenses:
79
80
  - MIT
80
- metadata: {}
81
+ metadata:
82
+ changelog_uri: https://github.com/andreleoni/extends_bool/blob/master/CHANGELOG.md
83
+ homepage_uri: https://github.com/andreleoni/extends_bool
84
+ source_code_uri: https://github.com/andreleoni/extends_bool
81
85
  post_install_message:
82
86
  rdoc_options: []
83
87
  require_paths:
@@ -97,6 +101,6 @@ rubyforge_project:
97
101
  rubygems_version: 2.7.8
98
102
  signing_key:
99
103
  specification_version: 4
100
- summary: Adds `.to_bool` behaviour to String, Integer, Float, Array, Hash, TrueClass,
104
+ summary: Adds ".to_bool" behaviour to String, Integer, Float, Array, Hash, TrueClass,
101
105
  FalseClass and NilClass.
102
106
  test_files: []