Class: DS::Extractor::Language

Inherits:
BaseTerm
  • Object
show all
Defined in:
lib/ds/extractor/language.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:, codes: Set.new) ⇒ Language

Initializes the Language object with the provided as_recorded and codes.

Parameters:

  • as_recorded (String)

    the as_recorded value

  • codes (Set) (defaults to: Set.new)

    the language codes



13
14
15
16
# File 'lib/ds/extractor/language.rb', line 13

def initialize as_recorded:, codes: Set.new
  @codes       = codes
  super(as_recorded: as_recorded)
end

Instance Attribute Details

#codesObject

Returns the value of attribute codes.



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

def codes
  @codes
end

Instance Method Details

#to_aObject



18
19
20
# File 'lib/ds/extractor/language.rb', line 18

def to_a
  [as_recorded, codes]
end

#to_hObject



22
23
24
25
26
27
28
# File 'lib/ds/extractor/language.rb', line 22

def to_h
  {
    language_as_recorded: as_recorded,
    as_recorded: as_recorded,
    language_code: codes.join(';')
  }
end