Class: MLA

Inherits:
RuleBase show all
Defined in:
lib/citation/rules/mla.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
22
23
24
25
# File 'lib/citation/rules/mla.rb', line 12

def self.fetch(string, base)
  title = @matcher[0]
  string.slice!('()')
  s = string.split(title)
  string.slice!(title)
  title.gsub!('"','')

  author = s.shift
  desc   = s.shift
  type   = 'MLA'.to_sym
  string.slice!(author) unless string.empty?
  string.slice!(desc) unless string.empty?
  return string, title, author, desc, type
end

.satisfy?(string, base) ⇒ Boolean

Returns:

  • (Boolean)


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

def self.satisfy?(string, base)
  @matcher = string.match(/".+"/)
  !@matcher.nil?
end