Class: Datacite::Mapping::FundingReference

Inherits:
Object
  • Object
show all
Includes:
XML::Mapping
Defined in:
lib/datacite/mapping/funding_reference.rb

Instance Method Summary collapse

Constructor Details

#initialize(name:, identifier: nil, award_number: nil, award_title: nil) ⇒ FundingReference

Returns a new instance of FundingReference.



97
98
99
100
101
102
# File 'lib/datacite/mapping/funding_reference.rb', line 97

def initialize(name:, identifier: nil, award_number: nil, award_title: nil)
  self.name = name
  self.identifier = identifier
  self.award_number = award_number
  self.award_title = award_title
end

Instance Method Details

#award_number=(value)



104
105
106
# File 'lib/datacite/mapping/funding_reference.rb', line 104

def award_number=(value)
  @award_number = award_number_or_nil(value)
end

#to_s



108
109
110
111
# File 'lib/datacite/mapping/funding_reference.rb', line 108

def to_s
  fields = %i[name identifier award_number award_title].map { |f| "#{f}: #{send(f)}" }
  "FundingReference { #{fields.join(', ')} }"
end