Module: Datacite::Mapping

Defined in:
lib/datacite/mapping.rb,
lib/datacite/mapping/date.rb,
lib/datacite/mapping/title.rb,
lib/datacite/mapping/rights.rb,
lib/datacite/mapping/creator.rb,
lib/datacite/mapping/subject.rb,
lib/datacite/mapping/resource.rb,
lib/datacite/mapping/identifier.rb,
lib/datacite/mapping/contributor.rb,
lib/datacite/mapping/description.rb,
lib/datacite/mapping/module_info.rb,
lib/datacite/mapping/geo_location.rb,
lib/datacite/mapping/resource_type.rb,
lib/datacite/mapping/name_identifier.rb,
lib/datacite/mapping/geo_location_box.rb,
lib/datacite/mapping/geo_location_point.rb,
lib/datacite/mapping/related_identifier.rb,
lib/datacite/mapping/alternate_identifier.rb

Overview

Maps DataCite XML to Ruby objects

Defined Under Namespace

Classes: AlternateIdentifier, BreakPreservingValueNode, Contributor, ContributorType, Creator, Date, DateType, Description, DescriptionType, GeoLocation, GeoLocationBox, GeoLocationBoxNode, GeoLocationPoint, GeoLocationPointNode, Identifier, NameIdentifier, RelatedIdentifier, RelatedIdentifierType, RelationType, Resource, ResourceType, ResourceTypeGeneral, Rights, Subject, Title, TitleType

Constant Summary collapse

NAME =

The name of this gem

'datacite-mapping'
VERSION =

The version of this gem

'0.1.2'
'Copyright (c) 2015 The Regents of the University of California'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.log ⇒ Logger

Gets the logger for the module. Default logger logs to $stdout.

Returns:

  • (Logger) —

    the logger



14
15
16
17
# File 'lib/datacite/mapping.rb', line 14

def self.log
  self.log_device = $stdout unless @log
  @log
end

Class Method Details

.log_device=(value)

Sets the log device. Defaults to $stdout

Parameters:

  • value (IO) —

    the log device



21
22
23
# File 'lib/datacite/mapping.rb', line 21

def self.log_device=(value)
  @log = new_logger(logdev: value)
end

.new_logger(logdev:, level: Logger::DEBUG, shift_age: 10, shift_size: 1024 * 1024)



27
28
29
30
31
32
33
34
# File 'lib/datacite/mapping.rb', line 27

def self.new_logger(logdev:, level: Logger::DEBUG, shift_age: 10, shift_size: 1024 * 1024)
  logger = Logger.new(logdev, shift_age, shift_size)
  logger.level = level
  logger.formatter = proc do |severity, datetime, progname, msg|
    "#{datetime.to_time.utc} #{severity} -#{progname}- #{msg}\n"
  end
  logger
end