Ruby

Ruby

Oneliners

ruby -ne 'print if /^[RS]/' file.txt

Create a Gem

bundle gem mygem

├── Gemfile
├── LICENSE.txt
├── README.md
├── Rakefile
├── mygem.gemspec
└── lib
    ├── mygem
    │   └── version.rb
    └── mygem.rb
spec.add_dependency "http"
gem build mygem.gemspec

https://techandfi.com/how-to-create-a-ruby-gem/ https://quickleft.com/blog/wrapping-your-api-in-a-custom-ruby-gem/ https://bundler.io/v1.13/guides/creating_gem

Howtos

How To Chain Method Invocation

user.profile.settings.newsletter

# vs

['profile', 'settings', 'newsletter'].inject(user, :try)