class Zebra::Zpl::CharacterSet

Attributes

country_code[R]
language[R]
number_of_data_bits[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/zebra/zpl/character_set.rb, line 15
def initialize(options = {})
  options.each_pair { |attribute, value| self.__send__ "#{attribute}=", value }
end

Public Instance Methods

country_code=(code) click to toggle source
# File lib/zebra/zpl/character_set.rb, line 29
def country_code=(code)
  CountryCode.validate_country_code(code) unless code.nil?
  @country_code = code
end
language=(l) click to toggle source
# File lib/zebra/zpl/character_set.rb, line 24
def language=(l)
  Language.validate_language(l) unless l.nil?
  @language = l
end
number_of_data_bits=(nodb) click to toggle source
# File lib/zebra/zpl/character_set.rb, line 19
def number_of_data_bits=(nodb)
  raise InvalidNumberOfDataBits unless [7, 8, nil].include?(nodb)
  @number_of_data_bits = nodb
end
to_zpl() click to toggle source
# File lib/zebra/zpl/character_set.rb, line 34
def to_zpl
  raise MissingAttributeError.new("language") if language.nil?
  raise MissingAttributeError.new("number of data bits") if number_of_data_bits.nil?
  raise MissingAttributeError.new("country code") if number_of_data_bits == 8 && country_code.nil?
  raise CountryCodeNotApplicableForNumberOfDataBits if number_of_data_bits == 7 && !country_code.nil?
  Language.validate_language_for_number_of_data_bits language, number_of_data_bits

  ["I#{number_of_data_bits}", language, country_code].compact.join(",")
end