lib/barby/barcode/code_128.rb
def handle_code_b(data)
        indata = data.dup
        outdata = CODEB.dup #We know this is going to start with Code B
        while char = indata.slice!(0)
          if control_character?(char) #Found a control character (Code A)
            if control_before_lowercase?(indata)    #There is another control character before any lowercase, so
              outdata << handle_code_a(char+indata) #switch over to Code A.
              break
            else
              outdata << SHIFT << char #Can use a shift to only encode this char as Code A
            end
          else
            outdata << char
          end
        end#while

        outdata
      end
#Handle a Code B segment which may contain Code A parts, but may not
#contain any Code C parts.
Handle a Code B segment which may contain Code A parts, but may not
contain any Code C parts.
Handle a Code B segment which may contain Code A parts but may not contain any Code C parts .
def handle_code_b(data)
        indata = data.dup
        outdata = CODEB.dup 
        while char = indata.slice!(0)
          if control_character?(char) 
            if control_before_lowercase?(indata)    
              outdata << handle_code_a(char+indata) 
              break
            else
              outdata << SHIFT << char 
            end
          else
            outdata << char
          end
        end
        outdata
      end
def handle_code_b ( data ) indata = data . dup outdata = CODEB . dup while char = indata . slice! ( 0 ) if control_character? ( char ) if control_before_lowercase? ( indata ) outdata << handle_code_a ( char + indata ) break else outdata << SHIFT << char end else outdata << char end end outdata end
Handle a Code B segment which may contain Code A parts, but may not
contain any Code C parts.
Handle a Code B segment which may contain Code A parts but may not contain any Code C parts .
#We know this is going to start with Code B #Found a control character (Code A) #There is another control character before any lowercase, so #switch over to Code A. #Can use a shift to only encode this char as Code A #while
data