Class: DoiRecord

Inherits:
ApplicationRecord
  • Object
show all
Defined in:
app/models2/doi_record.rb

Instance Method Summary collapse

Instance Method Details

#normalizeObject



9
10
11
12
13
14
15
16
17
# File 'app/models2/doi_record.rb', line 9

def normalize
  url = URI.parse(body)
  if url.host =~ /doi\.org\Z/
    self.body = url.path.gsub(/\A\//, '').downcase
  else
    self.body = body.downcase
  end
rescue URI::InvalidURIError
end

#set_display_bodyObject



19
20
21
# File 'app/models2/doi_record.rb', line 19

def set_display_body
  self.display_body = body unless display_body
end