module Datacite::Mapping::ReadOnlyNodes
Public Class Methods
warn(warning)
click to toggle source
public to allow testing
Calls superclass method
# File lib/datacite/mapping/read_only_nodes.rb, line 43 def self.warn(warning) super end
Public Instance Methods
obj_to_xml(obj, _xml)
click to toggle source
# File lib/datacite/mapping/read_only_nodes.rb, line 29 def obj_to_xml(obj, _xml) val = value_from(obj) return unless val warn_ignored(val) end
value_from(obj)
click to toggle source
# File lib/datacite/mapping/read_only_nodes.rb, line 19 def value_from(obj) obj.send(@attrname) end
value_str(val)
click to toggle source
# File lib/datacite/mapping/read_only_nodes.rb, line 23 def value_str(val) return "[ #{val.map(&:to_s).join(', ')} ]" if val.is_a?(Array) "'#{val}'" end
warn_ignored(val)
click to toggle source
# File lib/datacite/mapping/read_only_nodes.rb, line 36 def warn_ignored(val) warning = "ignoring #{@attrname} #{value_str(val)}" warning = "#{warn_reason}; #{warning}" if warn_reason ReadOnlyNodes.warn(warning) end
warn_reason()
click to toggle source
# File lib/datacite/mapping/read_only_nodes.rb, line 15 def warn_reason @warn_reason ||= @options[:warn_reason] end