Class: AVR::MemoryByte

Inherits:
Object
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/avr/memory/memory_byte.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(memory, address, value) ⇒ MemoryByte

Returns a new instance of MemoryByte.



18
19
20
21
22
# File 'lib/avr/memory/memory_byte.rb', line 18

def initialize(memory, address, value)
  @memory = memory
  @address = address
  @value = value
end

Instance Attribute Details

#address ⇒ Object (readonly)

Returns the value of attribute address.



12
13
14
# File 'lib/avr/memory/memory_byte.rb', line 12

def address
  @address
end

#memory ⇒ Object (readonly)

Returns the value of attribute memory.



9
10
11
# File 'lib/avr/memory/memory_byte.rb', line 9

def memory
  @memory
end

#value ⇒ Object

Returns the value of attribute value.



15
16
17
# File 'lib/avr/memory/memory_byte.rb', line 15

def value
  @value
end

Instance Method Details

#chr ⇒ Object



40
41
42
# File 'lib/avr/memory/memory_byte.rb', line 40

def chr
  value.chr
end

#format ⇒ Object



25
26
27
# File 'lib/avr/memory/memory_byte.rb', line 25

def format
  '%02x'
end

#to_i ⇒ Object



30
31
32
# File 'lib/avr/memory/memory_byte.rb', line 30

def to_i
  value.to_i
end

#to_s ⇒ Object



35
36
37
# File 'lib/avr/memory/memory_byte.rb', line 35

def to_s
  value.to_s
end