Class: Argus::NavOption
- Inherits:
-
Object
show all
- Defined in:
- lib/argus/nav_option.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ NavOption
6
7
8
|
# File 'lib/argus/nav_option.rb', line 6
def initialize(data)
@tag, @size = data.unpack("vv")
end
|
Instance Attribute Details
#tag ⇒ Object
Returns the value of attribute tag.
4
5
6
|
# File 'lib/argus/nav_option.rb', line 4
def tag
@tag
end
|
Class Method Details
Skip the tag and size fields, We’ve already handled them in the base class.
30
31
32
|
# File 'lib/argus/nav_option.rb', line 30
def self.initial_format
"x4"
end
|
.options ⇒ Object
14
15
16
|
# File 'lib/argus/nav_option.rb', line 14
def self.options
@options ||= { }
end
|
.parse(raw_data) ⇒ Object
22
23
24
25
26
|
# File 'lib/argus/nav_option.rb', line 22
def self.parse(raw_data)
tag = raw_data.unpack("v").first
option = options[tag] || NavOptionUnknown
option.new(raw_data)
end
|
.register(option) ⇒ Object
18
19
20
|
# File 'lib/argus/nav_option.rb', line 18
def self.register(option)
options[option.tag] = option
end
|
Instance Method Details
#size ⇒ Object
10
11
12
|
# File 'lib/argus/nav_option.rb', line 10
def size
@size < 4 ? 4 : @size
end
|