module CiteProc::Abbreviate

Attributes

namespace[RW]

Public Instance Methods

abbrev(*arguments)
Alias for: abbreviate
abbreviate(*arguments) click to toggle source

@overload abbreviate(namespace = :default, context, word)

# File lib/citeproc/abbreviate.rb, line 22
          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

arguments[0] = arguments[0].to_sym
arguments[1] = arguments[1].to_sym

                  abbreviations.deep_fetch(*arguments)
          end
Also aliased as: abbrev
abbreviations() click to toggle source
# File lib/citeproc/abbreviate.rb, line 6
def abbreviations
        @abbreviations ||= { :default => {} }
end
abbreviations=(abbreviations) click to toggle source
# File lib/citeproc/abbreviate.rb, line 10
def abbreviations=(abbreviations)
        @abbreviations = case abbreviations
                when ::String
                        ::JSON.parse(abbreviations, :symbolize_names => true)
                when ::Hash
                        abbreviations.deep_copy.symbolize_keys
                else
                        raise ArgumentError, "failed to set abbreviations from #{abbreviations.inspect}"
                end
end