Class: Gemstash::DB::Rubygem

Inherits:
Sequel::Model
  • Object
show all
Defined in:
lib/gemstash/db/rubygem.rb

Overview

Sequel model for rubygems table.

Class Method Summary collapse

Class Method Details

.find_or_insert(spec) ⇒ Object



7
8
9
10
11
# File 'lib/gemstash/db/rubygem.rb', line 7

def self.find_or_insert(spec)
  record = self[name: spec.name]
  return record.id if record
  new(name: spec.name).tap(&:save).id
end