Module: OSRMTextInstructions

Defined in:
lib/osrm_text_instructions.rb,
lib/osrm_text_instructions/utils.rb,
lib/osrm_text_instructions/version.rb,
lib/osrm_text_instructions/compiler.rb

Defined Under Namespace

Modules: Utils Classes: Compiler

Constant Summary collapse

VERSION =
"0.1.1"

Class Method Summary collapse

Class Method Details

.compile(step, locale: 'en', version: 'v5') ⇒ Object



7
8
9
# File 'lib/osrm_text_instructions.rb', line 7

def self.compile(step, locale: 'en', version: 'v5')
  Compiler.new(load_instruction_yaml(locale), version).compile(step)
end

.load_instruction_yaml(locale) ⇒ Object



11
12
13
14
15
# File 'lib/osrm_text_instructions.rb', line 11

def self.load_instruction_yaml(locale)
  YAML.load_file(File.expand_path("#{__dir__}/../i18n/#{locale}.yml"))
rescue Errno::ENOENT => e
  raise "Locale #{locale} not available"
end