naught 1.0.0 → 2.0.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 +5 -5
- data/LICENSE.txt +1 -1
- data/lib/naught/basic_object.rb +4 -14
- data/lib/naught/call_location.rb +131 -0
- data/lib/naught/caller_info.rb +128 -0
- data/lib/naught/chain_proxy.rb +51 -0
- data/lib/naught/conversions.rb +108 -34
- data/lib/naught/null_class_builder/command.rb +42 -5
- data/lib/naught/null_class_builder/commands/callstack.rb +89 -0
- data/lib/naught/null_class_builder/commands/define_explicit_conversions.rb +25 -9
- data/lib/naught/null_class_builder/commands/define_implicit_conversions.rb +22 -12
- data/lib/naught/null_class_builder/commands/impersonate.rb +21 -5
- data/lib/naught/null_class_builder/commands/mimic.rb +87 -25
- data/lib/naught/null_class_builder/commands/null_safe_proxy.rb +92 -0
- data/lib/naught/null_class_builder/commands/pebble.rb +21 -18
- data/lib/naught/null_class_builder/commands/predicates_return.rb +51 -31
- data/lib/naught/null_class_builder/commands/singleton.rb +18 -17
- data/lib/naught/null_class_builder/commands/traceable.rb +21 -12
- data/lib/naught/null_class_builder/commands.rb +10 -8
- data/lib/naught/null_class_builder.rb +217 -120
- data/lib/naught/stub_strategy.rb +30 -0
- data/lib/naught/version.rb +3 -1
- data/lib/naught.rb +31 -7
- metadata +34 -66
- data/.gitignore +0 -23
- data/.rspec +0 -2
- data/.rubocop.yml +0 -74
- data/.travis.yml +0 -20
- data/Changelog.md +0 -12
- data/Gemfile +0 -31
- data/Guardfile +0 -15
- data/README.markdown +0 -436
- data/Rakefile +0 -15
- data/naught.gemspec +0 -22
- data/spec/base_object_spec.rb +0 -47
- data/spec/basic_null_object_spec.rb +0 -35
- data/spec/blackhole_spec.rb +0 -16
- data/spec/explicit_conversions_spec.rb +0 -23
- data/spec/functions/actual_spec.rb +0 -22
- data/spec/functions/just_spec.rb +0 -22
- data/spec/functions/maybe_spec.rb +0 -35
- data/spec/functions/null_spec.rb +0 -34
- data/spec/implicit_conversions_spec.rb +0 -25
- data/spec/mimic_spec.rb +0 -117
- data/spec/naught/null_object_builder/command_spec.rb +0 -10
- data/spec/naught/null_object_builder_spec.rb +0 -31
- data/spec/naught_spec.rb +0 -101
- data/spec/pebble_spec.rb +0 -77
- data/spec/predicate_spec.rb +0 -84
- data/spec/singleton_null_object_spec.rb +0 -35
- data/spec/spec_helper.rb +0 -13
- data/spec/support/convertable_null.rb +0 -4
- data/spec/support/jruby.rb +0 -3
- data/spec/support/rubinius.rb +0 -3
- data/spec/support/ruby_18.rb +0 -3
|
@@ -1,186 +1,283 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
1
|
+
require "naught/basic_object"
|
|
2
|
+
require "naught/conversions"
|
|
3
|
+
require "naught/stub_strategy"
|
|
3
4
|
|
|
4
5
|
module Naught
|
|
6
|
+
# Builds customized null object classes via a small DSL
|
|
7
|
+
#
|
|
8
|
+
# @api public
|
|
5
9
|
class NullClassBuilder
|
|
6
|
-
#
|
|
7
|
-
|
|
8
|
-
end
|
|
10
|
+
# Namespace for builder command classes
|
|
11
|
+
# @api private
|
|
12
|
+
module Commands; end
|
|
13
|
+
|
|
14
|
+
# The base class for generated null objects
|
|
15
|
+
#
|
|
16
|
+
# @return [Class] base class for generated null objects
|
|
17
|
+
# @example
|
|
18
|
+
# builder.base_class #=> Naught::BasicObject
|
|
19
|
+
attr_accessor :base_class
|
|
20
|
+
|
|
21
|
+
# The inspect implementation for generated null objects
|
|
22
|
+
#
|
|
23
|
+
# @return [Proc] inspect implementation for generated null objects
|
|
24
|
+
# @example
|
|
25
|
+
# builder.inspect_proc.call #=> "<null>"
|
|
26
|
+
attr_accessor :inspect_proc
|
|
9
27
|
|
|
10
|
-
|
|
28
|
+
# Whether a method-missing interface has been defined
|
|
29
|
+
#
|
|
30
|
+
# @return [Boolean] whether a method-missing interface has been defined
|
|
31
|
+
# @example
|
|
32
|
+
# builder.interface_defined #=> false
|
|
33
|
+
attr_accessor :interface_defined
|
|
34
|
+
|
|
35
|
+
# @!method interface_defined?
|
|
36
|
+
# Check if a method-missing interface has been defined
|
|
37
|
+
# @return [Boolean] true if interface is defined
|
|
38
|
+
# @example
|
|
39
|
+
# builder.interface_defined? #=> false
|
|
40
|
+
alias_method :interface_defined?, :interface_defined
|
|
11
41
|
|
|
42
|
+
# Create a new builder with default configuration
|
|
43
|
+
# @api private
|
|
12
44
|
def initialize
|
|
13
45
|
@interface_defined = false
|
|
14
|
-
@base_class
|
|
15
|
-
@inspect_proc
|
|
16
|
-
@stub_strategy
|
|
46
|
+
@base_class = Naught::BasicObject
|
|
47
|
+
@inspect_proc = -> { "<null>" }
|
|
48
|
+
@stub_strategy = StubStrategy::ReturnNil
|
|
17
49
|
define_basic_methods
|
|
18
50
|
end
|
|
19
51
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
52
|
+
# Apply a customization block to this builder
|
|
53
|
+
#
|
|
54
|
+
# @yieldparam builder [NullClassBuilder] builder instance
|
|
55
|
+
# @return [void]
|
|
56
|
+
# @example
|
|
57
|
+
# builder.customize { |b| b.black_hole }
|
|
58
|
+
def customize(&)
|
|
59
|
+
customization_module.module_exec(self, &) if block_given?
|
|
27
60
|
end
|
|
28
61
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
62
|
+
# Returns the module that holds customization methods
|
|
63
|
+
#
|
|
64
|
+
# @return [Module] module that holds customization methods
|
|
65
|
+
# @example
|
|
66
|
+
# builder.customization_module #=> #<Module:0x...>
|
|
67
|
+
def customization_module = @customization_module ||= Module.new
|
|
32
68
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
69
|
+
# Returns the list of values treated as null-equivalent
|
|
70
|
+
#
|
|
71
|
+
# @return [Array<Object>] values treated as null-equivalent
|
|
72
|
+
# @example
|
|
73
|
+
# builder.null_equivalents #=> [nil]
|
|
74
|
+
def null_equivalents = @null_equivalents ||= [nil]
|
|
36
75
|
|
|
76
|
+
# Generate the null object class based on queued operations
|
|
77
|
+
#
|
|
78
|
+
# @return [Class] generated null class
|
|
79
|
+
# @example
|
|
80
|
+
# NullClass = builder.generate_class
|
|
37
81
|
def generate_class
|
|
38
82
|
respond_to_any_message unless interface_defined?
|
|
39
|
-
generation_mod = Module.new
|
|
40
|
-
customization_mod = customization_module # get a local binding
|
|
41
|
-
builder = self
|
|
42
83
|
|
|
84
|
+
generation_mod = Module.new
|
|
43
85
|
apply_operations(operations, generation_mod)
|
|
44
86
|
|
|
45
|
-
null_class =
|
|
46
|
-
const_set :GeneratedMethods, generation_mod
|
|
47
|
-
const_set :Customizations, customization_mod
|
|
48
|
-
const_set :NULL_EQUIVS, builder.null_equivalents
|
|
49
|
-
include Conversions
|
|
50
|
-
remove_const :NULL_EQUIVS
|
|
51
|
-
Conversions.instance_methods.each do |instance_method|
|
|
52
|
-
undef_method(instance_method)
|
|
53
|
-
end
|
|
54
|
-
const_set :Conversions, Conversions
|
|
55
|
-
|
|
56
|
-
include NullObjectTag
|
|
57
|
-
include generation_mod
|
|
58
|
-
include customization_mod
|
|
59
|
-
end
|
|
60
|
-
|
|
87
|
+
null_class = build_null_class(generation_mod)
|
|
61
88
|
apply_operations(class_operations, null_class)
|
|
62
89
|
|
|
63
90
|
null_class
|
|
64
91
|
end
|
|
65
92
|
|
|
66
|
-
|
|
67
|
-
command_name = command_name_for_method(method_name)
|
|
68
|
-
if Commands.const_defined?(command_name)
|
|
69
|
-
command_class = Commands.const_get(command_name)
|
|
70
|
-
command_class.new(self, *args, &block).call
|
|
71
|
-
else
|
|
72
|
-
super
|
|
73
|
-
end
|
|
74
|
-
end
|
|
93
|
+
# Builder API - see also lib/naught/null_class_builder/commands
|
|
75
94
|
|
|
76
|
-
|
|
77
|
-
def respond_to_missing?(method_name, include_private = false)
|
|
78
|
-
command_name = command_name_for_method(method_name)
|
|
79
|
-
Commands.const_defined?(command_name) || super
|
|
80
|
-
rescue NameError
|
|
81
|
-
super
|
|
82
|
-
end
|
|
83
|
-
else
|
|
84
|
-
def respond_to?(method_name, include_private = false)
|
|
85
|
-
command_name = command_name_for_method(method_name)
|
|
86
|
-
Commands.const_defined?(command_name) || super
|
|
87
|
-
rescue NameError
|
|
88
|
-
super
|
|
89
|
-
end
|
|
90
|
-
end
|
|
91
|
-
|
|
92
|
-
############################################################################
|
|
93
|
-
# Builder API
|
|
95
|
+
# Configure method stubs to return self (black hole behavior)
|
|
94
96
|
#
|
|
95
|
-
#
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
# @see https://github.com/avdi/naught/issues/72
|
|
98
|
+
# @return [void]
|
|
99
|
+
# @example
|
|
100
|
+
# builder.black_hole
|
|
98
101
|
def black_hole
|
|
99
|
-
@stub_strategy =
|
|
102
|
+
@stub_strategy = StubStrategy::ReturnSelf
|
|
103
|
+
# Prepend marshal methods to avoid infinite recursion with method_missing
|
|
104
|
+
defer_prepend_module do
|
|
105
|
+
define_method(:marshal_dump) { nil }
|
|
106
|
+
define_method(:marshal_load) { |*| nil }
|
|
107
|
+
end
|
|
100
108
|
end
|
|
101
109
|
|
|
110
|
+
# Make null objects respond to any message
|
|
111
|
+
#
|
|
112
|
+
# @return [void]
|
|
113
|
+
# @example
|
|
114
|
+
# builder.respond_to_any_message
|
|
102
115
|
def respond_to_any_message
|
|
103
|
-
defer(:
|
|
104
|
-
subject.
|
|
105
|
-
def respond_to?(*)
|
|
106
|
-
true
|
|
107
|
-
end
|
|
108
|
-
end
|
|
116
|
+
defer(prepend: true) do |subject|
|
|
117
|
+
subject.define_method(:respond_to?) { |*, **| true }
|
|
109
118
|
stub_method(subject, :method_missing)
|
|
110
119
|
end
|
|
111
120
|
@interface_defined = true
|
|
112
121
|
end
|
|
113
122
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
123
|
+
# Queue a deferred operation to be applied during class generation
|
|
124
|
+
#
|
|
125
|
+
# @param options [Hash] :class for class-level, :prepend to add at front
|
|
126
|
+
# @yieldparam subject [Module, Class] target of the operation
|
|
127
|
+
# @return [void]
|
|
128
|
+
# @example
|
|
129
|
+
# builder.defer { |subject| subject.define_method(:foo) { "bar" } }
|
|
130
|
+
def defer(options = {}, &operation)
|
|
131
|
+
target = options[:class] ? class_operations : operations
|
|
132
|
+
options[:prepend] ? target.unshift(operation) : target.push(operation)
|
|
121
133
|
end
|
|
122
134
|
|
|
135
|
+
# Prepend a module generated from the given block
|
|
136
|
+
#
|
|
137
|
+
# @return [void]
|
|
138
|
+
# @example
|
|
139
|
+
# builder.defer_prepend_module { define_method(:foo) { "bar" } }
|
|
140
|
+
def defer_prepend_module(&)
|
|
141
|
+
prepend_modules << Module.new(&)
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Stub a method using the current stub strategy
|
|
145
|
+
#
|
|
146
|
+
# @param subject [Module, Class] target to define method on
|
|
147
|
+
# @param name [Symbol] method name to stub
|
|
148
|
+
# @return [void]
|
|
149
|
+
# @example
|
|
150
|
+
# builder.stub_method(some_module, :foo)
|
|
123
151
|
def stub_method(subject, name)
|
|
124
|
-
|
|
152
|
+
@stub_strategy.apply(subject, name)
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Dispatch builder DSL calls to command classes
|
|
156
|
+
# @return [void]
|
|
157
|
+
# @api private
|
|
158
|
+
def method_missing(method_name, *args, &)
|
|
159
|
+
command_class = lookup_command(method_name)
|
|
160
|
+
command_class ? command_class.new(self, *args, &).call : super
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
# Check if builder responds to a DSL command
|
|
164
|
+
#
|
|
165
|
+
# @param method_name [Symbol] method name to check
|
|
166
|
+
# @param include_private [Boolean] whether to include private methods
|
|
167
|
+
# @return [Boolean] true if method_name maps to a known command
|
|
168
|
+
# @api private
|
|
169
|
+
def respond_to_missing?(method_name, include_private = false)
|
|
170
|
+
!lookup_command(method_name).nil? || super
|
|
171
|
+
rescue NameError
|
|
172
|
+
super
|
|
125
173
|
end
|
|
126
174
|
|
|
127
175
|
private
|
|
128
176
|
|
|
177
|
+
# Build the null object class with all configured modules
|
|
178
|
+
#
|
|
179
|
+
# @param generation_mod [Module] module containing generated methods
|
|
180
|
+
# @return [Class] the null object class
|
|
181
|
+
# @api private
|
|
182
|
+
def build_null_class(generation_mod)
|
|
183
|
+
customization_mod = customization_module
|
|
184
|
+
null_equivs = null_equivalents
|
|
185
|
+
modules_to_prepend = prepend_modules
|
|
186
|
+
|
|
187
|
+
Class.new(@base_class) do
|
|
188
|
+
const_set :GeneratedMethods, generation_mod
|
|
189
|
+
const_set :Customizations, customization_mod
|
|
190
|
+
|
|
191
|
+
conversions_mod = Module.new { include Conversions }
|
|
192
|
+
Conversions.configure(conversions_mod, null_class: self, null_equivs: null_equivs)
|
|
193
|
+
const_set :Conversions, conversions_mod
|
|
194
|
+
|
|
195
|
+
include NullObjectTag
|
|
196
|
+
include generation_mod
|
|
197
|
+
include customization_mod
|
|
198
|
+
|
|
199
|
+
modules_to_prepend.each { |mod| prepend mod }
|
|
200
|
+
end
|
|
201
|
+
end
|
|
202
|
+
|
|
203
|
+
# Define the basic methods required by all null objects
|
|
204
|
+
#
|
|
205
|
+
# @return [void]
|
|
206
|
+
# @api private
|
|
129
207
|
def define_basic_methods
|
|
130
208
|
define_basic_instance_methods
|
|
131
209
|
define_basic_class_methods
|
|
132
210
|
end
|
|
133
211
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
212
|
+
# Apply deferred operations to the target module or class
|
|
213
|
+
#
|
|
214
|
+
# @param ops [Array<Proc>] operations to apply
|
|
215
|
+
# @param target [Module, Class] target for the operations
|
|
216
|
+
# @return [void]
|
|
217
|
+
# @api private
|
|
218
|
+
def apply_operations(ops, target)
|
|
219
|
+
ops.each { |op| op.call(target) }
|
|
138
220
|
end
|
|
139
221
|
|
|
222
|
+
# Define the basic instance methods for null objects
|
|
223
|
+
#
|
|
224
|
+
# @return [void]
|
|
225
|
+
# @api private
|
|
140
226
|
def define_basic_instance_methods
|
|
227
|
+
builder = self
|
|
141
228
|
defer do |subject|
|
|
142
|
-
subject.
|
|
143
|
-
|
|
144
|
-
def initialize(*)
|
|
145
|
-
end
|
|
146
|
-
end
|
|
229
|
+
subject.define_method(:inspect, &builder.inspect_proc)
|
|
230
|
+
subject.define_method(:initialize) { |*, **, &| }
|
|
147
231
|
end
|
|
148
232
|
end
|
|
149
233
|
|
|
234
|
+
# Define the basic class methods for null objects
|
|
235
|
+
#
|
|
236
|
+
# @return [void]
|
|
237
|
+
# @api private
|
|
150
238
|
def define_basic_class_methods
|
|
151
|
-
defer(:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
end
|
|
156
|
-
klass = self
|
|
157
|
-
define_method(:class) { klass }
|
|
239
|
+
defer(class: true) do |klass|
|
|
240
|
+
klass.define_singleton_method(:get) do |*args, **kwargs, &block|
|
|
241
|
+
kw = kwargs #: Hash[Symbol, untyped]
|
|
242
|
+
new(*args, **kw, &block)
|
|
158
243
|
end
|
|
244
|
+
klass.define_method(:class) { klass }
|
|
159
245
|
end
|
|
160
246
|
end
|
|
161
247
|
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
248
|
+
# Returns the list of class-level operations
|
|
249
|
+
#
|
|
250
|
+
# @return [Array<Proc>] class-level operations
|
|
251
|
+
# @api private
|
|
252
|
+
def class_operations = @class_operations ||= []
|
|
165
253
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
254
|
+
# Returns the list of instance-level operations
|
|
255
|
+
#
|
|
256
|
+
# @return [Array<Proc>] instance-level operations
|
|
257
|
+
# @api private
|
|
258
|
+
def operations = @operations ||= []
|
|
169
259
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
260
|
+
# Returns the list of modules to prepend
|
|
261
|
+
#
|
|
262
|
+
# @return [Array<Module>] modules to prepend to the null class
|
|
263
|
+
# @api private
|
|
264
|
+
def prepend_modules = @prepend_modules ||= []
|
|
175
265
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
266
|
+
# Look up a command class by method name
|
|
267
|
+
#
|
|
268
|
+
# @param method_name [Symbol] method name to look up
|
|
269
|
+
# @return [Class, nil] command class if found, nil otherwise
|
|
270
|
+
# @api private
|
|
271
|
+
def lookup_command(method_name)
|
|
272
|
+
command_name = camelize(method_name)
|
|
273
|
+
Commands.const_get(command_name) if Commands.const_defined?(command_name)
|
|
180
274
|
end
|
|
181
275
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
276
|
+
# Convert a snake_case method name to CamelCase
|
|
277
|
+
#
|
|
278
|
+
# @param name [Symbol, String] the name to convert
|
|
279
|
+
# @return [String] the CamelCase version
|
|
280
|
+
# @api private
|
|
281
|
+
def camelize(name) = name.to_s.gsub(/(?:^|_)([a-z])/) { ::Regexp.last_match(1).upcase }
|
|
185
282
|
end
|
|
186
283
|
end
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
module Naught
|
|
2
|
+
# Strategies for stubbing methods on null objects
|
|
3
|
+
#
|
|
4
|
+
# @api private
|
|
5
|
+
module StubStrategy
|
|
6
|
+
# Stub that returns nil from any method
|
|
7
|
+
module ReturnNil
|
|
8
|
+
# Define a method that returns nil
|
|
9
|
+
#
|
|
10
|
+
# @param subject [Module, Class] target to define method on
|
|
11
|
+
# @param name [Symbol] method name to define
|
|
12
|
+
# @return [void]
|
|
13
|
+
def self.apply(subject, name)
|
|
14
|
+
subject.define_method(name) { |*, **, &| nil }
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Stub that returns self from any method (black hole)
|
|
19
|
+
module ReturnSelf
|
|
20
|
+
# Define a method that returns self
|
|
21
|
+
#
|
|
22
|
+
# @param subject [Module, Class] target to define method on
|
|
23
|
+
# @param name [Symbol] method name to define
|
|
24
|
+
# @return [void]
|
|
25
|
+
def self.apply(subject, name)
|
|
26
|
+
subject.define_method(name) { |*, **, &| self }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
data/lib/naught/version.rb
CHANGED
data/lib/naught.rb
CHANGED
|
@@ -1,13 +1,37 @@
|
|
|
1
|
-
require
|
|
2
|
-
require
|
|
3
|
-
require
|
|
1
|
+
require "naught/version"
|
|
2
|
+
require "naught/caller_info"
|
|
3
|
+
require "naught/null_class_builder"
|
|
4
|
+
require "naught/null_class_builder/commands"
|
|
4
5
|
|
|
6
|
+
# Top-level namespace for Naught null object helpers
|
|
7
|
+
#
|
|
8
|
+
# @example Create a basic null object class
|
|
9
|
+
# NullObject = Naught.build
|
|
10
|
+
# null = NullObject.new
|
|
11
|
+
# null.foo #=> nil
|
|
12
|
+
#
|
|
13
|
+
# @example Create a black hole null object
|
|
14
|
+
# BlackHole = Naught.build(&:black_hole)
|
|
15
|
+
# BlackHole.new.foo.bar.baz #=> <null>
|
|
16
|
+
#
|
|
17
|
+
# @api public
|
|
5
18
|
module Naught
|
|
6
|
-
|
|
19
|
+
# Build a null object class using the builder DSL
|
|
20
|
+
#
|
|
21
|
+
# @example
|
|
22
|
+
# NullObject = Naught.build { |b| b.black_hole }
|
|
23
|
+
#
|
|
24
|
+
# @yieldparam builder [Naught::NullClassBuilder] builder DSL instance
|
|
25
|
+
# @return [Class] generated null class
|
|
26
|
+
def self.build(&)
|
|
7
27
|
builder = NullClassBuilder.new
|
|
8
|
-
builder.customize(&
|
|
28
|
+
builder.customize(&)
|
|
9
29
|
builder.generate_class
|
|
10
30
|
end
|
|
11
|
-
|
|
12
|
-
|
|
31
|
+
|
|
32
|
+
# Marker module mixed into generated null objects
|
|
33
|
+
module NullObjectTag; end
|
|
34
|
+
|
|
35
|
+
# Marker module for null-safe proxy wrappers
|
|
36
|
+
module NullSafeProxyTag; end
|
|
13
37
|
end
|
metadata
CHANGED
|
@@ -1,29 +1,42 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: naught
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version:
|
|
4
|
+
version: 2.0.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Avdi Grimm
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: bundler
|
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
|
16
15
|
requirements:
|
|
17
|
-
- - "
|
|
16
|
+
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version: '
|
|
18
|
+
version: '2.0'
|
|
20
19
|
type: :development
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
|
-
- - "
|
|
23
|
+
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version: '
|
|
25
|
+
version: '2.0'
|
|
26
|
+
- !ruby/object:Gem::Dependency
|
|
27
|
+
name: rake
|
|
28
|
+
requirement: !ruby/object:Gem::Requirement
|
|
29
|
+
requirements:
|
|
30
|
+
- - ">="
|
|
31
|
+
- !ruby/object:Gem::Version
|
|
32
|
+
version: '12.0'
|
|
33
|
+
type: :development
|
|
34
|
+
prerelease: false
|
|
35
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
36
|
+
requirements:
|
|
37
|
+
- - ">="
|
|
38
|
+
- !ruby/object:Gem::Version
|
|
39
|
+
version: '12.0'
|
|
27
40
|
description: Naught is a toolkit for building Null Objects
|
|
28
41
|
email:
|
|
29
42
|
- avdi@avdi.org
|
|
@@ -31,58 +44,36 @@ executables: []
|
|
|
31
44
|
extensions: []
|
|
32
45
|
extra_rdoc_files: []
|
|
33
46
|
files:
|
|
34
|
-
- ".gitignore"
|
|
35
|
-
- ".rspec"
|
|
36
|
-
- ".rubocop.yml"
|
|
37
|
-
- ".travis.yml"
|
|
38
|
-
- Changelog.md
|
|
39
|
-
- Gemfile
|
|
40
|
-
- Guardfile
|
|
41
47
|
- LICENSE.txt
|
|
42
|
-
- README.markdown
|
|
43
|
-
- Rakefile
|
|
44
48
|
- lib/naught.rb
|
|
45
49
|
- lib/naught/basic_object.rb
|
|
50
|
+
- lib/naught/call_location.rb
|
|
51
|
+
- lib/naught/caller_info.rb
|
|
52
|
+
- lib/naught/chain_proxy.rb
|
|
46
53
|
- lib/naught/conversions.rb
|
|
47
54
|
- lib/naught/null_class_builder.rb
|
|
48
55
|
- lib/naught/null_class_builder/command.rb
|
|
49
56
|
- lib/naught/null_class_builder/commands.rb
|
|
57
|
+
- lib/naught/null_class_builder/commands/callstack.rb
|
|
50
58
|
- lib/naught/null_class_builder/commands/define_explicit_conversions.rb
|
|
51
59
|
- lib/naught/null_class_builder/commands/define_implicit_conversions.rb
|
|
52
60
|
- lib/naught/null_class_builder/commands/impersonate.rb
|
|
53
61
|
- lib/naught/null_class_builder/commands/mimic.rb
|
|
62
|
+
- lib/naught/null_class_builder/commands/null_safe_proxy.rb
|
|
54
63
|
- lib/naught/null_class_builder/commands/pebble.rb
|
|
55
64
|
- lib/naught/null_class_builder/commands/predicates_return.rb
|
|
56
65
|
- lib/naught/null_class_builder/commands/singleton.rb
|
|
57
66
|
- lib/naught/null_class_builder/commands/traceable.rb
|
|
67
|
+
- lib/naught/stub_strategy.rb
|
|
58
68
|
- lib/naught/version.rb
|
|
59
|
-
- naught.gemspec
|
|
60
|
-
- spec/base_object_spec.rb
|
|
61
|
-
- spec/basic_null_object_spec.rb
|
|
62
|
-
- spec/blackhole_spec.rb
|
|
63
|
-
- spec/explicit_conversions_spec.rb
|
|
64
|
-
- spec/functions/actual_spec.rb
|
|
65
|
-
- spec/functions/just_spec.rb
|
|
66
|
-
- spec/functions/maybe_spec.rb
|
|
67
|
-
- spec/functions/null_spec.rb
|
|
68
|
-
- spec/implicit_conversions_spec.rb
|
|
69
|
-
- spec/mimic_spec.rb
|
|
70
|
-
- spec/naught/null_object_builder/command_spec.rb
|
|
71
|
-
- spec/naught/null_object_builder_spec.rb
|
|
72
|
-
- spec/naught_spec.rb
|
|
73
|
-
- spec/pebble_spec.rb
|
|
74
|
-
- spec/predicate_spec.rb
|
|
75
|
-
- spec/singleton_null_object_spec.rb
|
|
76
|
-
- spec/spec_helper.rb
|
|
77
|
-
- spec/support/convertable_null.rb
|
|
78
|
-
- spec/support/jruby.rb
|
|
79
|
-
- spec/support/rubinius.rb
|
|
80
|
-
- spec/support/ruby_18.rb
|
|
81
69
|
homepage: https://github.com/avdi/naught
|
|
82
70
|
licenses:
|
|
83
71
|
- MIT
|
|
84
|
-
metadata:
|
|
85
|
-
|
|
72
|
+
metadata:
|
|
73
|
+
homepage_uri: https://github.com/avdi/naught
|
|
74
|
+
source_code_uri: https://github.com/avdi/naught
|
|
75
|
+
changelog_uri: https://github.com/avdi/naught/blob/master/Changelog.md
|
|
76
|
+
rubygems_mfa_required: 'true'
|
|
86
77
|
rdoc_options: []
|
|
87
78
|
require_paths:
|
|
88
79
|
- lib
|
|
@@ -90,37 +81,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
90
81
|
requirements:
|
|
91
82
|
- - ">="
|
|
92
83
|
- !ruby/object:Gem::Version
|
|
93
|
-
version:
|
|
84
|
+
version: 3.2.0
|
|
94
85
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
95
86
|
requirements:
|
|
96
87
|
- - ">="
|
|
97
88
|
- !ruby/object:Gem::Version
|
|
98
89
|
version: '0'
|
|
99
90
|
requirements: []
|
|
100
|
-
|
|
101
|
-
rubygems_version: 2.2.1
|
|
102
|
-
signing_key:
|
|
91
|
+
rubygems_version: 4.0.5
|
|
103
92
|
specification_version: 4
|
|
104
93
|
summary: Naught is a toolkit for building Null Objects
|
|
105
|
-
test_files:
|
|
106
|
-
- spec/base_object_spec.rb
|
|
107
|
-
- spec/basic_null_object_spec.rb
|
|
108
|
-
- spec/blackhole_spec.rb
|
|
109
|
-
- spec/explicit_conversions_spec.rb
|
|
110
|
-
- spec/functions/actual_spec.rb
|
|
111
|
-
- spec/functions/just_spec.rb
|
|
112
|
-
- spec/functions/maybe_spec.rb
|
|
113
|
-
- spec/functions/null_spec.rb
|
|
114
|
-
- spec/implicit_conversions_spec.rb
|
|
115
|
-
- spec/mimic_spec.rb
|
|
116
|
-
- spec/naught/null_object_builder/command_spec.rb
|
|
117
|
-
- spec/naught/null_object_builder_spec.rb
|
|
118
|
-
- spec/naught_spec.rb
|
|
119
|
-
- spec/pebble_spec.rb
|
|
120
|
-
- spec/predicate_spec.rb
|
|
121
|
-
- spec/singleton_null_object_spec.rb
|
|
122
|
-
- spec/spec_helper.rb
|
|
123
|
-
- spec/support/convertable_null.rb
|
|
124
|
-
- spec/support/jruby.rb
|
|
125
|
-
- spec/support/rubinius.rb
|
|
126
|
-
- spec/support/ruby_18.rb
|
|
94
|
+
test_files: []
|
data/.gitignore
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
*.gem
|
|
2
|
-
*.rbc
|
|
3
|
-
.bundle
|
|
4
|
-
.config
|
|
5
|
-
.yardoc
|
|
6
|
-
Gemfile.lock
|
|
7
|
-
InstalledFiles
|
|
8
|
-
_yardoc
|
|
9
|
-
coverage
|
|
10
|
-
doc/
|
|
11
|
-
lib/bundler/man
|
|
12
|
-
pkg
|
|
13
|
-
rdoc
|
|
14
|
-
spec/reports
|
|
15
|
-
test/tmp
|
|
16
|
-
test/version_tmp
|
|
17
|
-
tmp
|
|
18
|
-
/naught.org
|
|
19
|
-
/naught.html
|
|
20
|
-
/bin
|
|
21
|
-
/TAGS
|
|
22
|
-
/gems.tags
|
|
23
|
-
/tags
|
data/.rspec
DELETED