Class: TaxPub::Utils

Inherits:
Object
  • Object
show all
Defined in:
lib/taxpub/utils.rb

Class Method Summary collapse

Class Method Details

.clean_text(text) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/taxpub/utils.rb', line 4

def self.clean_text(text)
  text.encode("UTF-8", :undef => :replace, :invalid => :replace, :replace => " ")
      .gsub(/[[:space:]]/, " ")
      .chomp(",")
      .split
      .join(" ")
end

.expand_doi(doi) ⇒ Object



12
13
14
15
16
17
# File 'lib/taxpub/utils.rb', line 12

def self.expand_doi(doi)
  if doi[0..2] == "10."
    doi.prepend("https://doi.org/")
  end
  doi
end