Class: Newsmlg2::Catalog

Inherits:
NarModel
  • Object
show all
Includes:
Base::AuthorityAttributes, Base::CommonPowerAttributes
Defined in:
lib/newsmlg2/catalog.rb

Overview

A local or remote catalog: a set of scheme alias-to-URI declarations.

Instance Method Summary collapse

Methods included from Base::AuthorityAttributes

included

Methods included from Base::CommonPowerAttributes

included

Instance Method Details

#get_scheme_for_alias(alias_name) ⇒ Object



20
21
22
# File 'lib/newsmlg2/catalog.rb', line 20

def get_scheme_for_alias(alias_name)
  schemes.find { |scheme| scheme.alias_attr == alias_name }
end

#get_scheme_for_uri(uri) ⇒ Object



24
25
26
# File 'lib/newsmlg2/catalog.rb', line 24

def get_scheme_for_uri(uri)
  schemes.find { |scheme| scheme.uri == uri }
end

#lengthObject



28
29
30
# File 'lib/newsmlg2/catalog.rb', line 28

def length
  schemes.length
end

#to_sObject



32
33
34
35
36
# File 'lib/newsmlg2/catalog.rb', line 32

def to_s
  return '<Catalog>' if titles.empty?

  "<Catalog \"#{titles.first}\">"
end