module CiteProc::Extensions::AliasMethods
based and compatible to the active support version module ToSentence
def to_sentence(options = {}) options = { :words_connector => ", ", :two_words_connector => " and ", :last_word_connector => ", and " }.merge!(options) case length when 0 "" when 1 self[0].to_s.dup when 2 "#{self[0]}#{options[:two_words_connector]}#{self[1]}" else "#{self[0...-1].join(options[:words_connector])}#{options[:last_word_connector]}#{self[-1]}" end end
end
Private Instance Methods
Source
# File lib/citeproc/extensions.rb, line 94 def alias_methods(*arguments) raise ArgumentError, "wrong number of arguments (#{arguments.length} for 2 or more)" if arguments.length < 2 method_id = arguments.shift arguments.each { |a| alias_method method_id, a } end