reactive_support 0.1.3.beta4 → 0.1.3
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 +4 -4
- data/README.md +0 -4
- data/lib/reactive_support/core_ext/object/blank.rb +23 -0
- data/spec/reactive_support_spec.rb +4 -2
- data/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 98b652c949f27c7bddcd372807affcdd75d17493
|
4
|
+
data.tar.gz: ea175e6c84e532cb9e7a0efd837b6160ea5b8f15
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7bc1f3cc4511bf351b9bbe414cc29b82789fde75770f786e7f046960d384be222629d0fa9caaf5e24afb23f735fbd71fd14def11274af80de6ee7671fca9f93f
|
7
|
+
data.tar.gz: 60019de6cab75f7c638938e2b030a49bc3136fe193f34369f4fbf60a6fbf2c5329c5307659cbcd9892d02b30393f0e1d76a4054b37b35d5ac1f316765e15b221
|
data/README.md
CHANGED
@@ -16,10 +16,6 @@ Then, in your main project file, include:
|
|
16
16
|
You can also point your Gemfile to this repo:
|
17
17
|
<pre><code>gem 'reactive_support', '~> 0.1.3', git: 'https://github.com/danascheider/reactive_support.git</code></pre>
|
18
18
|
|
19
|
-
If you would like to install an earlier version, you can specify that version's branch
|
20
|
-
using the standard branch naming scheme:
|
21
|
-
<pre><code>gem 'reactive_support', '~> 0.1.2', git: 'https://github.com/danascheider/reactive_support.git, branch: 'version-0.1.2'</code></pre>
|
22
|
-
|
23
19
|
Please note that version 0.1.2 is the earliest available version of ReactiveSupport, and is currently the only release labeled production ready.
|
24
20
|
|
25
21
|
### Usage
|
@@ -7,6 +7,29 @@
|
|
7
7
|
# 2.0.0[http://ruby-doc.org/core-2.1.3/String.html], or
|
8
8
|
# 1.9.3[http://ruby-doc.org/core-2.0.0/String.html].
|
9
9
|
|
10
|
+
class Object
|
11
|
+
|
12
|
+
# When called on a generic object, the +#blank?+ method returns +true+ if
|
13
|
+
# the object is false, empty, or nil. Other objects return +false+.
|
14
|
+
# For specific examples of different classes, see the class-specific
|
15
|
+
# definitions of +#blank?+.
|
16
|
+
# Time.now.blank? # => false
|
17
|
+
|
18
|
+
def blank?
|
19
|
+
respond_to?(:empty) ? !!empty : !self
|
20
|
+
end
|
21
|
+
|
22
|
+
# When called on a generic object, the +#present?+ method returns +true+ if
|
23
|
+
# the object is present and not empty. If the object is false, empty, or nil,
|
24
|
+
# +#present?+ returns +false+. For specific examples of different classes, see
|
25
|
+
# the class-specific definitions of +#present?+.
|
26
|
+
# Time.now.present? # => true
|
27
|
+
|
28
|
+
def present?
|
29
|
+
!blank?
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
10
33
|
class String
|
11
34
|
|
12
35
|
# When called on a string, the +#blank?+ method returns +true+ if the string
|
@@ -24,7 +24,8 @@ describe ReactiveSupport do
|
|
24
24
|
'non-blank object' => 'foo',
|
25
25
|
'TrueClass' => true,
|
26
26
|
'enumerable with blank members' => [nil, false],
|
27
|
-
'numeric' => 10
|
27
|
+
'numeric' => 10,
|
28
|
+
'something else' => Time.now
|
28
29
|
}
|
29
30
|
|
30
31
|
hash.each do |k,v|
|
@@ -244,7 +245,8 @@ describe ReactiveSupport do
|
|
244
245
|
'non-empty object' => ['foo'],
|
245
246
|
'TrueClass' => true,
|
246
247
|
'enumerable with blank members' => [nil, false],
|
247
|
-
'numeric' => 8.2
|
248
|
+
'numeric' => 8.2,
|
249
|
+
'something else' => Time.now
|
248
250
|
}
|
249
251
|
|
250
252
|
hash.each do |k,v|
|
data/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: reactive_support
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.3
|
4
|
+
version: 0.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dana Scheider
|
@@ -117,9 +117,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
117
117
|
version: 1.9.3
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
|
-
- - "
|
120
|
+
- - ">="
|
121
121
|
- !ruby/object:Gem::Version
|
122
|
-
version:
|
122
|
+
version: '0'
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
125
|
rubygems_version: 2.2.2
|