Class: RMasm::Byte

Inherits:
Primitive show all
Defined in:
lib/rmasm/primitive.rb

Overview

Represents a byte (8 bits)

Constant Summary collapse

MIN =
-128
MAX =
255

Instance Attribute Summary

Attributes inherited from Primitive

#value

Class Method Summary collapse

Methods inherited from Primitive

valid?

Methods inherited from DataType

valid?

Class Method Details

.from_str(str) ⇒ Object



79
80
81
# File 'lib/rmasm/primitive.rb', line 79

def self.from_str(str)
  str.unpack('c*')     
end

.rangeObject



73
74
75
# File 'lib/rmasm/primitive.rb', line 73

def self.range
  MIN..MAX
end

.read(io) ⇒ Object



82
83
84
# File 'lib/rmasm/primitive.rb', line 82

def self.read(io)
  # io.read_db()
end

.sizeofObject



76
77
78
# File 'lib/rmasm/primitive.rb', line 76

def self.sizeof
  1
end

.to_sObject



88
89
90
# File 'lib/rmasm/primitive.rb', line 88

def self.to_s
  "byte"
end

.write(io, value) ⇒ Object

io.read_db()



85
86
87
# File 'lib/rmasm/primitive.rb', line 85

def self.write(io,value)
  io.write_db(value)
end