Module: Rozi::Shared
- Included in:
- NameSearchProperties, DatumSetter, TrackFile, TrackProperties, Waypoint, WaypointFile
- Defined in:
- lib/rozi/shared.rb
Overview
Contains general functions for working with Ozi Explorer file formats
Defined Under Namespace
Modules: DatumSetter
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.
-
#unescape_text(text) ⇒ Object
Undoes the effect of #escape_text.
Instance Method Details
#datum_valid?(datum) ⇒ Boolean
Checks if datum
is a valid datum according to Ozi Explorer
49 50 51 |
# File 'lib/rozi/shared.rb', line 49 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
13 14 15 |
# File 'lib/rozi/shared.rb', line 13 def escape_text(text) text.gsub(/,/, "Ñ") end |
#interpret_color(color) ⇒ Integer
Converts the input to an RGB color represented by an integer
34 35 36 37 38 39 40 41 42 |
# File 'lib/rozi/shared.rb', line 34 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 |
#unescape_text(text) ⇒ Object
Undoes the effect of #escape_text
20 21 22 |
# File 'lib/rozi/shared.rb', line 20 def unescape_text(text) text.gsub(/Ñ/, ",") end |