Sha256: 8ba783b73cbf084de1e81f5a0fc50c8d56e2d99731497a4866cbdb3599d88056

Contents?: true

Size: 459 Bytes

Versions: 4

Compression:

Stored size: 459 Bytes

Contents

require "addressable"

module RelatonBib
  # Typed URI
  class TypedUri
    # @return [Symbol] :src/:obp/:rss
    attr_reader :type
    # @retutn [URI]
    attr_reader :content

    # @param type [String] src/obp/rss
    # @param content [String]
    def initialize(type:, content:)
      @type    = type
      @content = Addressable::URI.parse content if content
    end

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
relaton-bib-0.3.3 lib/relaton_bib/typed_uri.rb
relaton-bib-0.3.2 lib/relaton_bib/typed_uri.rb
relaton-bib-0.3.1 lib/relaton_bib/typed_uri.rb
relaton-bib-0.3.0 lib/relaton_bib/typed_uri.rb