Class: AVR::RegisterWithModification

Inherits:
Value
  • Object
show all
Extended by:
Forwardable, T::Sig
Defined in:
lib/avr/register_with_modification.rb

Instance Attribute Summary collapse

Attributes inherited from Value

#value

Instance Method Summary collapse

Methods inherited from Value

#format, #inspect, #to_i, #to_s, #value_hex

Constructor Details

#initialize(register, modification = :none) ⇒ RegisterWithModification

Returns a new instance of RegisterWithModification.



20
21
22
23
24
# File 'lib/avr/register_with_modification.rb', line 20

def initialize(register, modification = :none)
  @register = register
  @modification = T.let(T.must(modification), Symbol)
  super()
end

Instance Attribute Details

#modificationObject (readonly)

Returns the value of attribute modification.



17
18
19
# File 'lib/avr/register_with_modification.rb', line 17

def modification
  @modification
end

#registerObject (readonly)

Returns the value of attribute register.



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

def register
  @register
end

Instance Method Details

#nameObject



27
28
29
30
31
32
33
# File 'lib/avr/register_with_modification.rb', line 27

def name
  '%s%s%s' % [
    modification == :pre_decrement ? '-' : '',
    register.to_s,
    modification == :post_increment ? '+' : '',
  ]
end