Class: RMasm::Primitive

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

Overview

Base class for all primitives

Direct Known Subclasses

Byte, Char, DWord, Double, Float, Float2, Float3, Float4, QWord, Word

Instance Attribute Summary collapse

Class Method Summary collapse

Methods inherited from DataType

read, sizeof, write

Instance Attribute Details

#valueObject

Returns the value of attribute value.



29
30
31
# File 'lib/rmasm/primitive.rb', line 29

def value
  @value
end

Class Method Details

.from_str(str) ⇒ Object



34
35
36
37
# File 'lib/rmasm/primitive.rb', line 34

def self.from_str(str)
  nil
  # raise NotImplementedError.new("conversion from string not implemented on #{self}")
end

.rangeObject

Raises:

  • (NotImplementedError)


30
31
32
# File 'lib/rmasm/primitive.rb', line 30

def self.range
  raise NotImplementedError.new
end

.valid?(arg) ⇒ Boolean

By default, set the check on a range and wait for an Integer value

Returns:

  • (Boolean)


40
41
42
# File 'lib/rmasm/primitive.rb', line 40

def self.valid?(arg)
  return range === arg && arg.is_a?(Integer)
end