Sha256: e486e63a8e1c61626868cb88696a85717c413a69679cfdefc92b2f7cffbb4957
Contents?: true
Size: 639 Bytes
Versions: 1
Compression:
Stored size: 639 Bytes
Contents
require 'pathname' lib = Pathname.new(__FILE__).dirname.join().expand_path.to_s $:.unshift lib require 'base' class APA < RuleBase def self.satisfy?(string, base) @matcher = string.match(/\(\)\. .+\. /) base.type.empty? and not @matcher.nil? end def self.fetch(string, base) title = @matcher[0] unless @matcher.nil? title.gsub!(/"|\(\)\. /,'') string.slice!(title) s = string.split('(). ') author = s.shift desc = s.shift type = 'APA'.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/apa.rb |