nullz 0.5.0 → 0.6.0

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: b733432ecb5440b4e01a67cc4d883b32ac5233cfc398ee9d834f4a5f4ece2ef4
4
- data.tar.gz: 308b61f2e9ce2b7643a56c153789b8ad311de16c2b23efb1dc6bb478c8753f06
3
+ metadata.gz: b0e3503834934297d10f1b0631230645fbad2c96c5461a27f85b37bc1093462e
4
+ data.tar.gz: 144e0d1fdf69dcc32874be9e892ff1def5bae5cebe7826fde87201eb5de9c7f8
5
5
  SHA512:
6
- metadata.gz: 76b123a92bb1e636cf7595af2fd1d8a5701f75cbc00c4e46735bc0565c4c689ccd77f49e16ef8ac95a108628fe949575762a13f0e1a9c880127b23a6e47fada2
7
- data.tar.gz: aaec8fe9e0231b14e07981ed816ca56c509f9978ea8adc5149168d0ae51c6a4e72affa60d296dbbae77e929688abfda07954a4a7d392ccc240c7a826429f2788
6
+ metadata.gz: 4c12d55139debb4c3d702cb3f3d241e2798fc4f550d8d9dcfa4e7318bca2f65c749a6786376bcaacde846c60e7764b1babe0dbbb0b865049ed709aa5af572c3a
7
+ data.tar.gz: 89b40bd49c475a9d195598bf42e30a0fe64867d1d563e6bcb6572c427ec72469e11bf12aff5917133ab8126168405ebaae2734d7ced7a94388106d8c28600900
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nullz (0.5.0)
4
+ nullz (0.6.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/lib/null_object.rb CHANGED
@@ -1,93 +1,94 @@
1
1
  require 'nullz/version'
2
2
 
3
- ON_NULL_OBJECT_CREATED = Proc.new { }
4
- USE_NULL_OBJECT = false
5
-
6
3
  def _(obj)
7
- obj || NullObject.new
4
+ obj || Nullz::NullObject.new
8
5
  end
9
6
 
10
- def __(obj, on_null_object_created_proc = ON_NULL_OBJECT_CREATED)
7
+ def __(obj, on_null_object_created_proc = Nullz::ON_NULL_OBJECT_CREATED)
11
8
  return obj if obj
12
9
 
13
10
  on_null_object_created_proc.call
14
11
 
15
- NullObject.new
12
+ Nullz::NullObject.new
16
13
  end
17
14
 
18
- def safe(obj, on_null_object_created_proc = ON_NULL_OBJECT_CREATED)
19
- USE_NULL_OBJECT ? __(obj, on_null_object_created_proc) : obj
15
+ def safe(obj, on_null_object_created_proc = Nullz::ON_NULL_OBJECT_CREATED)
16
+ Nullz::USE_NULL_OBJECT ? __(obj, on_null_object_created_proc) : obj
20
17
  end
21
18
 
22
- class NullObject
23
- def method_missing(method, *_args, &_block)
24
- return false if method.to_s.index('?')
25
- NullObject.new unless method == :to_ary
26
- end
27
-
28
- def to_s
29
- ''
30
- end
31
-
32
- alias_method :to_str, :to_s
33
-
34
- def coerce(value)
35
- [NullObject.new, value]
36
- end
37
-
38
- def return_null_object(_value)
39
- NullObject.new
40
- end
41
-
42
- alias_method :+, :return_null_object
43
- alias_method :-, :return_null_object
44
- alias_method :*, :return_null_object
45
- alias_method :/, :return_null_object
46
- alias_method :|, :return_null_object
47
- alias_method :^, :return_null_object
48
- alias_method :~, :return_null_object
49
- alias_method :&, :return_null_object
50
- alias_method :[], :return_null_object
51
- alias_method :<<, :return_null_object
52
- alias_method :>>, :return_null_object
53
-
54
- def ==(value)
55
- value.nil?
56
- end
57
-
58
- def !=(value)
59
- !value.nil?
60
- end
61
-
62
- def to_int
63
- 0
64
- end
65
-
66
- def to_bool
67
- false
68
- end
69
-
70
- alias_method :to_b, :to_bool
71
-
72
- def >(_value)
73
- return false
74
- end
75
-
76
- def <(_value)
77
- return false
78
- end
79
-
80
- def empty?
81
- true
82
- end
83
-
84
- def nil?
85
- true
86
- end
87
-
88
- def null?
89
- true
19
+ module Nullz
20
+ ON_NULL_OBJECT_CREATED = Proc.new { }
21
+ USE_NULL_OBJECT = false
22
+
23
+ class NullObject
24
+ def method_missing(method, *_args, &_block)
25
+ return false if method.to_s.index('?')
26
+ NullObject.new unless method == :to_ary
27
+ end
28
+
29
+ def to_s
30
+ ''
31
+ end
32
+
33
+ alias_method :to_str, :to_s
34
+
35
+ def coerce(value)
36
+ [NullObject.new, value]
37
+ end
38
+
39
+ def return_null_object(_value)
40
+ NullObject.new
41
+ end
42
+
43
+ alias_method :+, :return_null_object
44
+ alias_method :-, :return_null_object
45
+ alias_method :*, :return_null_object
46
+ alias_method :/, :return_null_object
47
+ alias_method :|, :return_null_object
48
+ alias_method :^, :return_null_object
49
+ alias_method :~, :return_null_object
50
+ alias_method :&, :return_null_object
51
+ alias_method :[], :return_null_object
52
+ alias_method :<<, :return_null_object
53
+ alias_method :>>, :return_null_object
54
+
55
+ def ==(value)
56
+ value.nil?
57
+ end
58
+
59
+ def !=(value)
60
+ !value.nil?
61
+ end
62
+
63
+ def to_int
64
+ 0
65
+ end
66
+
67
+ def to_bool
68
+ false
69
+ end
70
+
71
+ alias_method :to_b, :to_bool
72
+
73
+ def >(_value)
74
+ return false
75
+ end
76
+
77
+ def <(_value)
78
+ return false
79
+ end
80
+
81
+ def empty?
82
+ true
83
+ end
84
+
85
+ def nil?
86
+ true
87
+ end
88
+
89
+ def null?
90
+ true
91
+ end
90
92
  end
91
93
  end
92
94
 
93
-
data/lib/nullz/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Nullz
2
- VERSION = '0.5.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nullz
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Jacobs
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-03 00:00:00.000000000 Z
11
+ date: 2019-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler