Class: BTPR880
Constant Summary
collapse
- ESC =
27.chr
- GS =
29.chr
- CODES =
{
:bold => ESC+"E",
:underline => ESC+"-",
:small => ESC+"M",
:invert => GS+"B",
:linebreak => "\n"
}
- TRANSLATE =
{
:strong => [CODES[:bold]+"1", CODES[:bold]+"0"],
:u => [CODES[:underline]+"1", CODES[:underline]+"0"],
:small => [CODES[:small]+"1", CODES[:small]+"0"],
:mark => [CODES[:invert]+"1", CODES[:invert]+"0"],
:br => [CODES[:linebreak], ""]
}
Class Method Summary
collapse
endCode, getCode, startCode
Class Method Details
.print(ip, port = 9001) {|sock| ... } ⇒ Object
27
28
29
30
31
|
# File 'lib/devices/btpr880.rb', line 27
def self.print(ip, port=9001, &block)
sock = TCPSocket.new(ip, port)
yield sock if block_given?
sock.close
end
|
.translate ⇒ Object
23
24
25
|
# File 'lib/devices/btpr880.rb', line 23
def self.translate
TRANSLATE
end
|