README.md in nil_conditional-2.0.0 vs README.md in nil_conditional-2.0.1

- old
+ new

@@ -14,11 +14,11 @@ `nil_conditional` is gemified and available on RubyGems. ## Usage -Use `?_` method as Nil Conditional Operator. +Use `_?` method as Nil Conditional Operator. For example: `logger._?.log('some debug information')` ```ruby # logger is nil @@ -27,40 +27,39 @@ # logger is nil logger._?.foo.bar.car.cow => #<NilConditional> -# logger exists and all methods are valid +# logger is not nil and all corresponding methods exist logger._?.foo.bar.car.cow => "moooo" -# logger exists and all methods are valid -logger._?.foo.bar.car.cow -=> "moooo" - -# logger exists but doesn't have warn method +# logger is not nil but doesn't have warn method logger._?.warn('some warning') => #<NilConditional> -# logger exists and have warn method, but foo is invalid +# logger is not nil and have warn method, but foo is invalid +# - first not nil value returned by receiver in train wreck breaks nil condition logger._?.warn('some warning').foo => NoMethodError: undefined method `foo` +# ... but you can use nil conditional again logger._?.warn('some warning')._?.foo => #<NilConditional> -Object.new.non_existent_method +# this works also with class methods +Object.non_existent_method NoMethodError: undefined method `non_existent_method` for #<Object> -Object.new._?.non_existent_method +Object._?.non_existent_method => #<NilConditional> +# NilConditional object is eql to nil Object.new._?.non_existent_method.nil? => true ``` -`NilConditional` instances always return new NilConditional object if method is missing. -These objects are also `eql` to `nil`. +`NilConditional` instances always return new NilConditional object if method is missing. Those objects are also `eql` to `nil`. ## Changelog * Changes from version with major 1