Class: Interscript::Mapping

Inherits:
Object
  • Object
show all
Defined in:
lib/interscript/mapping.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(system_code, options = {}) ⇒ Mapping

Returns a new instance of Mapping.



36
37
38
39
40
41
42
43
44
45
# File 'lib/interscript/mapping.rb', line 36

def initialize(system_code, options = {})
  @system_code = system_code
  @depth = options.fetch(:depth, 0).to_i

  unless RUBY_ENGINE == 'opal'
    @system_path = options.fetch(:system_code, default_path)
  end

  load_and_serialize_system_mappings
end

Instance Attribute Details

#authority_idObject (readonly)

Returns the value of attribute authority_id.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def authority_id
  @authority_id
end

#chainObject (readonly)

Returns the value of attribute chain.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def chain
  @chain
end

#character_separatorObject (readonly)

Returns the value of attribute character_separator.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def character_separator
  @character_separator
end

#charactersObject (readonly)

Returns the value of attribute characters.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def characters
  @characters
end

#characters_hashObject (readonly)

Returns the value of attribute characters_hash.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def characters_hash
  @characters_hash
end

#creation_dateObject (readonly)

Returns the value of attribute creation_date.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def creation_date
  @creation_date
end

#descriptionObject (readonly)

Returns the value of attribute description.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def description
  @description
end

#destination_scriptObject (readonly)

Returns the value of attribute destination_script.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def destination_script
  @destination_script
end

#dictionaryObject (readonly)

Returns the value of attribute dictionary.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def dictionary
  @dictionary
end

#dictionary_hashObject (readonly)

Returns the value of attribute dictionary_hash.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def dictionary_hash
  @dictionary_hash
end

#dictionary_trieObject (readonly)

Returns the value of attribute dictionary_trie.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def dictionary_trie
  @dictionary_trie
end

#downcaseObject (readonly)

Returns the value of attribute downcase.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def downcase
  @downcase
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def id
  @id
end

#languageObject (readonly)

Returns the value of attribute language.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def language
  @language
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def name
  @name
end

#notesObject (readonly)

Returns the value of attribute notes.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def notes
  @notes
end

#postrulesObject (readonly)

Returns the value of attribute postrules.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def postrules
  @postrules
end

#rulesObject (readonly)

Returns the value of attribute rules.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def rules
  @rules
end

#segmentationObject (readonly)

Returns the value of attribute segmentation.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def segmentation
  @segmentation
end

#source_scriptObject (readonly)

Returns the value of attribute source_script.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def source_script
  @source_script
end

#testsObject (readonly)

Returns the value of attribute tests.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def tests
  @tests
end

#title_caseObject (readonly)

Returns the value of attribute title_case.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def title_case
  @title_case
end

#transcriptionObject (readonly)

Returns the value of attribute transcription.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def transcription
  @transcription
end

#urlObject (readonly)

Returns the value of attribute url.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def url
  @url
end

#word_separatorObject (readonly)

Returns the value of attribute word_separator.



8
9
10
# File 'lib/interscript/mapping.rb', line 8

def word_separator
  @word_separator
end

Class Method Details

.for(system_code, options = {}) ⇒ Object



47
48
49
# File 'lib/interscript/mapping.rb', line 47

def self.for(system_code, options = {})
  new(system_code, options)
end

Instance Method Details

#load_and_serialize_system_mappingsObject



51
52
53
54
55
56
# File 'lib/interscript/mapping.rb', line 51

def load_and_serialize_system_mappings
  return if depth >= 5

  mappings = load_system_mappings
  serialize_system_mappings(mappings)
end