Class: DS::Extractor::Genre

Inherits:
BaseTerm show all
Defined in:
lib/ds/extractor/genre.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:, source_authority_uri: nil, vocab: nil) ⇒ void

Initializes a new Genre object.

Parameters:

  • as_recorded (String) —

    the recorded data

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

    the source authority URI (default is nil)

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

    the vocab (default is nil)



16
17
18
19
20
21
22
23
24
# File 'lib/ds/extractor/genre.rb', line 16

def initialize(
  as_recorded:,
  source_authority_uri: nil,
  vocab: nil
)
  @source_authority_uri = source_authority_uri
  @vocab           = vocab
  super(as_recorded: as_recorded)
end

Instance Attribute Details

#source_authority_uri ⇒ Object

Returns the value of attribute source_authority_uri.



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

def source_authority_uri
  @source_authority_uri
end

#vocab ⇒ Object

Returns the value of attribute vocab.



7
8
9
# File 'lib/ds/extractor/genre.rb', line 7

def vocab
  @vocab
end

Instance Method Details

#to_a ⇒ Array<String>

Returns an array containing the recorded data, vocab, and source authority URI.

Returns:

  • (Array<String>)


28
29
30
# File 'lib/ds/extractor/genre.rb', line 28

def to_a
  [as_recorded, vocab, source_authority_uri]
end

#to_h ⇒ Hash<Symbol,String>

Returns a hash representation of the Genre object.

Returns:

  • (Hash<Symbol,String>) —

    a hash with keys :as_recorded, :source_authority_uri, and :vocab



35
36
37
38
39
40
41
42
# File 'lib/ds/extractor/genre.rb', line 35

def to_h
  {
    genre_as_recorded: as_recorded,
    as_recorded: as_recorded,
    source_authority_uri: source_authority_uri,
    vocab: vocab
  }
end