Class: ISO

Inherits:
RuleBase show all
Defined in:
lib/citation/rules/iso.rb

Instance Attribute Summary

Attributes inherited from RuleBase

#matcher

Class Method Summary collapse

Class Method Details

.fetch(string, base) ⇒ Object



12
13
14
15
16
17
18
19
20
21
# File 'lib/citation/rules/iso.rb', line 12

def self.fetch(string, base)
  s = string.gsub(/ ([A-Z]). /,'_\1_ ')
  string.gsub!('()','')
  arr = s.split('. ')
  author = arr.shift.gsub(/_([A-Z])_ /,' \1. ')
  title = arr.shift if title == '' or title.nil?
  desc = arr.shift
  type = 'ISO 6900'.to_sym
  return string, title, author, desc, type
end

.satisfy?(string, base) ⇒ Boolean



7
8
9
10
# File 'lib/citation/rules/iso.rb', line 7

def self.satisfy?(string, base)
  @matcher = string.match(/, \.$/)
  base.type.empty? and not @matcher.nil?
end