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:

  • phone (String)


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

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)


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

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

#to_xml(doc) ⇒ Object

Parameters:

  • builder (Nokogiri::XML::Document)


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

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