Class: RelatonBib::TypedUri

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

Overview

Typed URI

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type:, content:) ⇒ TypedUri

Returns a new instance of TypedUri.

Parameters:

  • type (String)

    src/obp/rss

  • content (String)


13
14
15
16
# File 'lib/relaton_bib/typed_uri.rb', line 13

def initialize(type:, content:)
  @type    = type
  @content = Addressable::URI.parse content if content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



9
10
11
# File 'lib/relaton_bib/typed_uri.rb', line 9

def content
  @content
end

#typeSymbol (readonly)

Returns :src/:obp/:rss.

Returns:

  • (Symbol)

    :src/:obp/:rss



7
8
9
# File 'lib/relaton_bib/typed_uri.rb', line 7

def type
  @type
end

Instance Method Details

#to_xml(builder) ⇒ Object



18
19
20
# File 'lib/relaton_bib/typed_uri.rb', line 18

def to_xml(builder)
  builder.uri(content.to_s, type: type)
end