Class: Midos::Writer::Thesaurus

Inherits:
Midos::Writer show all
Defined in:
lib/midos/writer.rb

Direct Known Subclasses

ThesaurusX

Constant Summary collapse

PROLOGUE =
{
  PAR: '1011111111110000000010001000000000000010',
  DAT: '00000000',
  DES: 'DE',
  TOP: 'TP~TP',
  KLA: 'CC~CC',
  OBR: 'BT~BT',
  UTR: 'NT~NT',
  SYN: 'UF~USE',
  FRU: 'PT~PT für',
  VER: 'RT~RT',
  SP1: 'ENG~ENG für',
  SP2: 'FRA~FRA für',
  SP3: 'SPA~SPA für',
  SP4: 'ITA~ITA für',
  SP5: 'GRI~GRI für',
  SP6: 'RUS~RUS für',
  SP7: 'POL~POL für',
  SP8: 'UNG~UNG für',
  SP9: 'TSC~TSC für',
  SN1: 'SN1',
  SN2: 'SN2',
  SN3: 'SN3',
  SN4: 'SN4',
  SN5: 'SN5',
  DA1: 'DATE1',
  DA2: 'DATE2',
  DA3: 'DATE3',
  DA4: 'DATE4',
  KLD: 'MIDOS Thesaurus',
  KOM: ' / ',
  KO1: 'UF',
  KO2: 'USE',
  TLE: '  32000 Zeichen',
  PAW: '',
  ART: '00000',
  REL: ' 17  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 18 19 20 21 22 23 24 25'
}
EPILOGUE =
{
  DE: '*****NICHTDESKRIPTORRELATIONEN*****'
}
RESOLVE_FROM =
[:OBR, :UTR, :VER]
RESOLVE_TO =
:DES
NAME =
:KLD

Constants inherited from Midos::Writer

DEFAULT_IO

Instance Attribute Summary collapse

Attributes inherited from Base

#auto_id, #fs, #io, #key, #le, #nl, #rs, #vs

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Midos::Writer

#[]=, #put, transform, #vs=, #write, write_file

Methods inherited from Base

#reset

Constructor Details

#initialize(options = {}, prologue = {}, epilogue = {}, &block) ⇒ Thesaurus

Returns a new instance of Thesaurus.



183
184
185
186
187
188
189
190
# File 'lib/midos/writer.rb', line 183

def initialize(options = {}, prologue = {}, epilogue = {}, &block)
  super(options, &block)

  prologue[self.class::NAME] ||= options[:name]

  @prologue = self.class::PROLOGUE.merge(prologue)
  @epilogue = self.class::EPILOGUE.merge(epilogue)
end

Instance Attribute Details

#epilogueObject (readonly)

Returns the value of attribute epilogue.



192
193
194
# File 'lib/midos/writer.rb', line 192

def epilogue
  @epilogue
end

#prologueObject (readonly)

Returns the value of attribute prologue.



192
193
194
# File 'lib/midos/writer.rb', line 192

def prologue
  @prologue
end

Class Method Details

.open(*args, &block) ⇒ Object



177
178
179
# File 'lib/midos/writer.rb', line 177

def open(*args, &block)
  super { |mth| mth.instruct!(&block) }
end

.write(*args, &block) ⇒ Object



172
173
174
175
# File 'lib/midos/writer.rb', line 172

def write(*args, &block)
  new(args.extract_options!, &block)
    .instruct! { |mth| mth.write(*args) }
end

Instance Method Details

#instruct!(*args) {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



194
195
196
197
198
# File 'lib/midos/writer.rb', line 194

def instruct!(*args)
  put(prologue, *args)
  yield self
  put(epilogue, *args)
end