Sha256: bf4be4706416d0f968bcb77c709a3602e6fb6fba499ddee7642c37b93c453d0d

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

# nil-conditional

Nil Conditional Operator in Ruby.

## Summary

This gem introduces Nil Conditional Operator (`_?`) in Ruby, similar to Null Conditional Operator in C# 6.0.

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'nil_conditional'
```

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install nil_conditional

## Usage

```ruby
empty_object = Object.new
empty_object.non_existent_method_?
=> nil

empty_object_?
=> #<Object:0x00000002d89170> 

non_existent_object_?
=> nil

"test_string".sub_?("_string", '_case')
=> "test_case"

:test_string.sub_?("string", "case")
=> nil

Object.foo_?.bar_?.car_?.cow_?
=> nil
```

## License

This is free software, licensed under MIT License. See LICENSE.txt file.

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nil_conditional-0.0.1 README.md