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/nonvalidating.rb,
lib/datacite/mapping/resource_type.rb,
lib/datacite/mapping/name_identifier.rb,
lib/datacite/mapping/geo_location_box.rb,
lib/datacite/mapping/funding_reference.rb,
lib/datacite/mapping/geo_location_point.rb,
lib/datacite/mapping/related_identifier.rb,
lib/datacite/mapping/alternate_identifier.rb,
lib/datacite/mapping/nonvalidating/subject.rb,
lib/datacite/mapping/nonvalidating/identifier.rb

Overview

Maps DataCite XML to Ruby objects

Defined Under Namespace

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

Constant Summary collapse

DATACITE_3_NAMESPACE =
XML::MappingExtensions::Namespace.new(
  uri: 'http://datacite.org/schema/kernel-3',
  schema_location: 'http://schema.datacite.org/meta/kernel-3/metadata.xsd'
)
DOI_PATTERN =
%r{10\..+/.+}
NAME =

The name of this gem

'datacite-mapping'
VERSION =

The version of this gem

'0.1.17.2'
'Copyright (c) 2016 The Regents of the University of California'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.logLogger

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

Returns:

  • (Logger)

    the logger



16
17
18
19
# File 'lib/datacite/mapping.rb', line 16

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



23
24
25
# File 'lib/datacite/mapping.rb', line 23

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

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



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

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