Sha256: f2a83d3b2ee5a05d090be3b0aa7bc92e6c183ac383a7b831fb9fa75a84637fb1
Contents?: true
Size: 877 Bytes
Versions: 1
Compression:
Stored size: 877 Bytes
Contents
module Rea class Command module Utils DEFAULT_INFO = { :title => "[Unknown title]", :authors => ["[Unknown author]"], :year => "[Unknown year]", :key => "[Unknown key]", :source => "[Unknown source]", } def pretty(rel, keep = nil) keep ||= [:code, :key, :author, :title, :year, :source] Relation(rel). defaults(DEFAULT_INFO). extend(:authors => lambda{ authors.empty? ? ["[Unknown author]"] : authors }). extend( :code => lambda{ authors.first.split(/\s/).last + year.to_s }, :title => lambda{ title[0..50] }, :author => lambda{ authors.first } ).project(keep) rescue Relation(rel).project(keep) end end # module Utils end # class Command end # module Rea
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rea-0.0.1 | lib/rea/command/utils.rb |