Sha256: b20513c14a8aa5179cdb94be21683da1db039dbfae70779dcd2fecb468b812fb

Contents?: true

Size: 600 Bytes

Versions: 1

Compression:

Stored size: 600 Bytes

Contents

require 'pathname'
lib = Pathname.new(__FILE__).dirname.join().expand_path.to_s
$:.unshift lib
require 'base'

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

  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
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
citation-0.1.1 lib/citation/rules/mla.rb