Sha256: ddd192f62b3d243f04ae52364788c0cb64124634e10d4caa4e29384e91356048
Contents?: true
Size: 809 Bytes
Versions: 13
Compression:
Stored size: 809 Bytes
Contents
module CiteProc module Abbreviate attr_accessor :namespace def abbreviations @abbreviations ||= { :default => {} } end def abbreviations=(abbreviations) @abbreviations = case abbreviations when ::String MultiJson.decode(abbreviations, :symbolize_keys => true) when ::Hash abbreviations.deep_copy else raise ArgumentError, "failed to set abbreviations from #{abbreviations.inspect}" end end # @overload abbreviate(namespace = :default, context, word) def abbreviate(*arguments) raise ArgumentError, "wrong number of arguments (#{arguments.length} for 2..3)" unless (2..3).include?(arguments.length) arguments.unshift(namespace || :default) if arguments.length < 3 @abbreviations.deep_fetch(*arguments) end alias abbrev abbreviate end end
Version data entries
13 entries across 13 versions & 1 rubygems