Class: Gorails::Commands::Jobs

Inherits:
Gorails::Command
  • Object
show all
Defined in:
lib/gorails/commands/jobs.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.helpObject



20
21
22
# File 'lib/gorails/commands/jobs.rb', line 20

def self.help
  "View the latest Ruby on Rails jobs.\nUsage: {{command:#{Gorails::TOOL_NAME} jobs}}"
end

Instance Method Details

#call(_args, _name) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/gorails/commands/jobs.rb', line 8

def call(_args, _name)
  jobs = JSON.parse Net::HTTP.get(URI("https://jobs.gorails.com/jobs.json"))

  CLI::UI::Frame.open("Ruby on Rails jobs") do
    jobs.each do |job|
      puts CLI::UI.fmt "{{green:#{job["title"]}}} at {{blue:#{job.dig("company", "name")}}}"
      puts job["url"]
      puts
    end
  end
end