naught
naught copied to clipboard
A toolkit for building Null Object classes in Ruby
This PR updates and services the CI matrix. ### Things done to get to green - [x] 1.8.7 can use RSpec `~> 2.99`. It can not install Rubocop. [Bundler issue...
Is the user supposed to define their own `#marshal_dump` so it can work with `Marshal`? ```ruby NullObject = Naught.build { |c| c.black_hole } # fails because marshal_dump returns itself and...
I am in the process of updating an app to Ruby 2.4.0. I found I needed to use: ``` ruby NullBeaneater = Naught.build do |config| config.black_hole end ``` form in...
Seems that this can be refactored further.
As requested in Issue #6. I'm completely open to name changes. I just picked some reasonable names to start with. It doesn't mention it in Issue #6 but we need...
I'm running into really weird behavior when trying to compose combinations of `impersonate`, `black_hole`, and `predicates_return(false)` in the same naught builder. Should I not do this? For example, I'd like...
I wanted to be able to do something like this ``` ruby Locals = Naught.build do |c| c.black_hole def to_s __callstack__.join('.') end end ```
Wrap `myvalue` and intercept each method call, wrapping the return value. If ANY call returns nil, replace it with a null object: ``` ruby SomeConversionFunc(myvalue).foo.bar.baz # => ``` Counterpoint: without...
``` ruby # without config.predicates_return false NullObject = Naught.build do |config| def coerce(other) [0, other] end end null = NullObject.new; 1 / null # => 0 # with config.predicates_return false...