Class: Zebra::Epl::CharacterSet
- Inherits:
-
Object
- Object
- Zebra::Epl::CharacterSet
- Defined in:
- lib/zebra/epl/character_set.rb
Defined Under Namespace
Classes: CountryCodeNotApplicableForNumberOfDataBits, InvalidNumberOfDataBits, MissingAttributeError
Instance Attribute Summary collapse
-
#country_code ⇒ Object
Returns the value of attribute country_code.
-
#language ⇒ Object
Returns the value of attribute language.
-
#number_of_data_bits ⇒ Object
Returns the value of attribute number_of_data_bits.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CharacterSet
constructor
A new instance of CharacterSet.
- #to_epl ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ CharacterSet
Returns a new instance of CharacterSet.
15 16 17 |
# File 'lib/zebra/epl/character_set.rb', line 15 def initialize( = {}) .each_pair { |attribute, value| self.__send__ "#{attribute}=", value } end |
Instance Attribute Details
#country_code ⇒ Object
Returns the value of attribute country_code.
13 14 15 |
# File 'lib/zebra/epl/character_set.rb', line 13 def country_code @country_code end |
#language ⇒ Object
Returns the value of attribute language.
13 14 15 |
# File 'lib/zebra/epl/character_set.rb', line 13 def language @language end |
#number_of_data_bits ⇒ Object
Returns the value of attribute number_of_data_bits.
13 14 15 |
# File 'lib/zebra/epl/character_set.rb', line 13 def number_of_data_bits @number_of_data_bits end |
Instance Method Details
#to_epl ⇒ Object
34 35 36 37 38 39 40 41 42 |
# File 'lib/zebra/epl/character_set.rb', line 34 def to_epl 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 |