Class: Dvi::Opcode::SetPutBase
- Defined in:
- lib/dvi/opcode.rb
Overview
PrintChar is a base class for set/put opcodes.
Instance Attribute Summary
Attributes inherited from SetChar
Class Method Summary collapse
-
.read(cmd, io) ⇒ Object
:nodoc:.
Instance Method Summary collapse
-
#initialize(index, n) ⇒ SetPutBase
constructor
- index
- character index n
-
read byte length.
Methods inherited from SetChar
Methods inherited from Base
Constructor Details
#initialize(index, n) ⇒ SetPutBase
- index
-
character index
- n
-
read byte length
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/dvi/opcode.rb', line 61 def initialize(index, n) if case n when 1; 0 <= index && index < 256 when 2; 0 <= index && index < 65536 when 3; 0 <= index && index < 16777216 when 4; -2147483648 <= index && index < 2147483648 end then @index = index else raise ArgumentError, [index, n] end end |
Class Method Details
.read(cmd, io) ⇒ Object
:nodoc:
75 76 77 78 79 80 |
# File 'lib/dvi/opcode.rb', line 75 def self.read(cmd, io) #:nodoc: base = if self == Set then 127 else 132 end n = cmd - base f = if n < 4 then "read_uint" + n.to_s else "read_int4" end return self.new(io.__send__(f), n) end |