Class: Citation::Article

Inherits:
Citation show all
Includes:
JournalLike
Defined in:
lib/citation.rb

Direct Known Subclasses

PubMed

Instance Attribute Summary collapse

Attributes included from JournalLike

#journal_full, #journal_iso, #journal_medline

Attributes inherited from Citation

#abstract, #authors, #bibtype, #ident, #quotes

Instance Method Summary collapse

Methods included from JournalLike

#has_journal?, #set_journal_from_medline

Methods inherited from Citation

#initialize, #to_hash, #to_yaml

Constructor Details

This class inherits a constructor from Citation

Instance Attribute Details

#issueObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def issue
  @issue
end

#monthObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def month
  @month
end

#pagesObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def pages
  @pages
end

#titleObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def title
  @title
end

#volObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def vol
  @vol
end

#yearObject

ident = unique identifier for placing in papers



111
112
113
# File 'lib/citation.rb', line 111

def year
  @year
end

Instance Method Details

#==(other) ⇒ Object



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
# File 'lib/citation.rb', line 113

def ==(other)
  if self.respond_to? :pmid
    if other.respond_to?(:pmid) && (self.pmid == other.pmid)
      return true
    else
      return false
    end
  else
    %w(title year month vol issue pages journal_medline bibtype).each do |v|
      if self.send(v.to_sym) != other.send(v.to_sym)
        return false
      end
    end
  end
  return true
end

#pages_fullObject



130
131
132
133
134
135
136
137
138
139
# File 'lib/citation.rb', line 130

def pages_full
  st_p, end_p = @pages.split('-')
  if !@pages.include?('.') && end_p && end_p.to_i < st_p.to_i  # 123-29
    diff = st_p.size - end_p.size
    new_end_p = st_p[0,diff] + end_p
    [st_p, new_end_p].join('-')
  else
    @pages
  end
end