Class: DS::Extractor::Subject

Inherits:
BaseTerm
  • Object
show all
Defined in:
lib/ds/extractor/subject.rb

Instance Attribute Summary collapse

Attributes inherited from BaseTerm

#as_recorded

Instance Method Summary collapse

Methods inherited from BaseTerm

#==, #eql?, #hash

Constructor Details

#initialize(as_recorded:, subfield_codes: nil, vocab: nil, source_authority_uri: nil) ⇒ void

Initializes a new Subject instance with the provided parameters.

Parameters:

  • as_recorded (String)

    The recorded data.

  • subfield_codes (String, nil) (defaults to: nil)

    The subfield codes.

  • vocab (String, nil) (defaults to: nil)

    The vocabulary.

  • source_authority_uri (String, nil) (defaults to: nil)

    The source authority URI.



19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ds/extractor/subject.rb', line 19

def initialize(
  as_recorded:,
  subfield_codes: nil,
  vocab: nil,
  source_authority_uri: nil
)

  @subfield_codes       = subfield_codes
  @vocab                = vocab
  @source_authority_uri = source_authority_uri

  super as_recorded: as_recorded
end

Instance Attribute Details

#source_authority_uriObject

Returns the value of attribute source_authority_uri.



9
10
11
# File 'lib/ds/extractor/subject.rb', line 9

def source_authority_uri
  @source_authority_uri
end

#subfield_codesObject

Returns the value of attribute subfield_codes.



8
9
10
# File 'lib/ds/extractor/subject.rb', line 8

def subfield_codes
  @subfield_codes
end

#vocabObject

Returns the value of attribute vocab.



10
11
12
# File 'lib/ds/extractor/subject.rb', line 10

def vocab
  @vocab
end

Instance Method Details

#to_aArray<String>

Returns an array representation of the Subject instance.

Values are: [as_recorded, subfield_codes, vocab, source_authority_uri]

Returns:

  • (Array<String>)

    An array containing the recorded data, subfield codes, vocabulary, and source authority URI.



38
39
40
# File 'lib/ds/extractor/subject.rb', line 38

def to_a
  [as_recorded, subfield_codes, vocab, source_authority_uri]
end

#to_hHash<Symbol,String>

Returns a hash representation of the Subject instance.

Keys are :as_recorded, :subfield_codes, :vocab, :source_authority_uri

Returns:

  • (Hash<Symbol,String>)

    A hash containing the recorded data, subfield codes, vocabulary, and source authority URI.



47
48
49
50
51
52
53
54
55
# File 'lib/ds/extractor/subject.rb', line 47

def to_h
  {
    subject_as_recorded:  as_recorded,
    as_recorded:          as_recorded,
    subfield_codes:       subfield_codes,
    vocab:                vocab,
    source_authority_uri: source_authority_uri
  }
end