Module: Rozi::OziFunctions
- Included in:
- NameSearchText, Track, TrackWriter, Waypoint, WaypointWriter
- Defined in:
- lib/rozi/ozi_functions.rb
Overview
Contains general functions for working with Ozi Explorer file formats.
Instance Method Summary collapse
-
#datum_valid?(datum) ⇒ Boolean
Checks if
datum
is a valid datum according to Ozi Explorer. -
#escape_text(text) ⇒ String
Escapes commas so the text can be used in Ozi file formats.
-
#interpret_color(color) ⇒ Integer
Converts the input to an RGB color represented by an integer.
Instance Method Details
#datum_valid?(datum) ⇒ Boolean
Checks if datum
is a valid datum according to Ozi Explorer.
43 44 45 |
# File 'lib/rozi/ozi_functions.rb', line 43 def datum_valid?(datum) Rozi::DATUMS.include? datum end |
#escape_text(text) ⇒ String
Escapes commas so the text can be used in Ozi file formats.
14 15 16 |
# File 'lib/rozi/ozi_functions.rb', line 14 def escape_text(text) text.gsub(/,/, 209.chr.encode("UTF-8", "ISO-8859-1")) end |
#interpret_color(color) ⇒ Integer
Converts the input to an RGB color represented by an integer.
28 29 30 31 32 33 34 35 36 |
# File 'lib/rozi/ozi_functions.rb', line 28 def interpret_color(color) if color.is_a? String # Turns RRGGBB into BBGGRR for hex conversion. color = color[-2..-1] << color[2..3] << color[0..1] color = color.to_i(16) end color end |