Class: AVR::Value
- Inherits:
-
Object
show all
- Extended by:
- T::Sig
- Defined in:
- lib/avr/value.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(value = 0) ⇒ Value
Returns a new instance of Value.
15
16
17
18
|
# File 'lib/avr/value.rb', line 15
def initialize(value = 0)
@name = T.let(:Constant, Symbol)
@value = T.let(value, Integer)
end
|
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
9
10
11
|
# File 'lib/avr/value.rb', line 9
def name
@name
end
|
#value ⇒ Object
Returns the value of attribute value.
12
13
14
|
# File 'lib/avr/value.rb', line 12
def value
@value
end
|
Instance Method Details
21
22
23
|
# File 'lib/avr/value.rb', line 21
def format
'%02x'
end
|
#inspect ⇒ Object
41
42
43
|
# File 'lib/avr/value.rb', line 41
def inspect
"#<#{self.class.name} #{self}>"
end
|
#to_i ⇒ Object
31
32
33
|
# File 'lib/avr/value.rb', line 31
def to_i
value.to_i
end
|
#to_s ⇒ Object
36
37
38
|
# File 'lib/avr/value.rb', line 36
def to_s
name.to_s
end
|
#value_hex ⇒ Object
26
27
28
|
# File 'lib/avr/value.rb', line 26
def value_hex
format % value
end
|