Class: Zebra::Zpl::Language
- Inherits:
-
Object
- Object
- Zebra::Zpl::Language
- Defined in:
- lib/zebra/zpl/language.rb
Defined Under Namespace
Classes: InvalidLanguageError, InvalidLanguageForNumberOfDataBitsError
Constant Summary collapse
- ENGLISH_US =
8 bits languages
"0"- LATIN_1 =
"1"- LATIN_2 =
"2"- PORTUGUESE =
"3"- FRENCH_CANADIAN =
"4"- NORDIC =
"5"- TURKISH =
"6"- ICELANDIC =
"7"- HEBREW =
"8"- CYRILLIC =
"9"- CYRILLIC_CIS_1 =
"10"- GREEK =
"11"- GREEK_1 =
"12"- GREEK_2 =
"13"- LATIN_1_WINDOWS =
"A"- LATIN_2_WINDOWS =
"B"- CYRILLIC_WINDOWS =
"C"- GREEK_WINDOWS =
"D"- TURKISH_WINDOWS =
"E"- HEBREW_WINDOWS =
"F"- USA =
7 bits languages
"0"- BRITISH =
"1"- GERMAN =
"2"- FRENCH =
"3"- DANISH =
"4"- ITALIAN =
"5"- SPANISH =
"6"- SWEDISH =
"7"- SWISS =
"8"
Class Method Summary collapse
- .valid_language?(language) ⇒ Boolean
- .validate_language(language) ⇒ Object
- .validate_language_for_number_of_data_bits(language, number_of_data_bits) ⇒ Object
Class Method Details
.valid_language?(language) ⇒ Boolean
41 42 43 |
# File 'lib/zebra/zpl/language.rb', line 41 def self.valid_language?(language) ("0".."13").include?(language) || ("A".."F").include?(language) end |
.validate_language(language) ⇒ Object
45 46 47 |
# File 'lib/zebra/zpl/language.rb', line 45 def self.validate_language(language) raise InvalidLanguageError unless valid_language?(language) end |
.validate_language_for_number_of_data_bits(language, number_of_data_bits) ⇒ Object
49 50 51 52 53 54 55 56 57 |
# File 'lib/zebra/zpl/language.rb', line 49 def self.validate_language_for_number_of_data_bits(language, number_of_data_bits) if number_of_data_bits == 8 validate_8_data_bits_language language elsif number_of_data_bits == 7 validate_7_data_bits_language language else raise ArgumentError.new("Unknown number of data bits") end end |