Skip to content

Ruby

Storing Objects in YAML with Ruby | local files
Ghost Methods: method_missing | local
Remco’s tutorials

Web/HTTP requests🔗

https://www.twilio.com/blog/5-ways-make-http-requests-ruby
Basic GET request

1
2
3
4
5
6
7
# nethttp.rb
require 'uri'
require 'net/http'

uri = URI('https://api.nasa.gov/planetary/apod?api_key=DEMO_KEY')
res = Net::HTTP.get_response(uri)
puts res.body if res.is_a?(Net::HTTPSuccess)

Packages & Repos🔗

Gemfile🔗

Install gem from Git repository

1
gem 'redcarpet', :git => 'git://github.com/tanoku/redcarpet.git', :branch => 'yourbranch'

Bundle🔗

Install ruby gems locally (for project)

1
2
bundle config set --local path '.bundle'
bundle install

Execute commands

1
bundle exec <command>

RVM (Ruby Version Manager)🔗

2023-05-08:
Failed to fetch a version of ruby for me

1
rvm install ruby-3