Class: RelatonBib::Contact

Inherits:
Object
  • Object
show all
Defined in:
lib/relaton_bib/contributor.rb

Overview

Contact class.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, value:) ⇒ Contact

Returns a new instance of Contact.

Parameters:

  • type (String)

    allowed “phone”, “email” or “uri”

  • value (String)


69
70
71
72
# File 'lib/relaton_bib/contributor.rb', line 69

def initialize(type:, value:)
  @type  = type
  @value = value
end

Instance Attribute Details

#typeString (readonly)

Returns allowed “phone”, “email” or “uri”.

Returns:

  • (String)

    allowed “phone”, “email” or “uri”



62
63
64
# File 'lib/relaton_bib/contributor.rb', line 62

def type
  @type
end

#valueString (readonly)

Returns:

  • (String)


65
66
67
# File 'lib/relaton_bib/contributor.rb', line 65

def value
  @value
end

Instance Method Details

#to_hashHash

Returns:

  • (Hash)


80
81
82
# File 'lib/relaton_bib/contributor.rb', line 80

def to_hash
  { "type" => type, "value" => value }
end

#to_xml(doc) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Document)


75
76
77
# File 'lib/relaton_bib/contributor.rb', line 75

def to_xml(doc)
  doc.send type, value
end