Class: Argus::NavOption
- Inherits:
-
Object
- Object
- Argus::NavOption
- Defined in:
- lib/argus/nav_option.rb
Direct Known Subclasses
NavOptionChecksum, NavOptionDemo, NavOptionUnknown, NavOptionVisionDetect
Instance Attribute Summary collapse
-
#tag ⇒ Object
readonly
Returns the value of attribute tag.
Class Method Summary collapse
-
.initial_format ⇒ Object
Skip the tag and size fields, We’ve already handled them in the base class.
- .options ⇒ Object
- .parse(raw_data) ⇒ Object
- .register(option) ⇒ Object
Instance Method Summary collapse
-
#initialize(data) ⇒ NavOption
constructor
A new instance of NavOption.
- #size ⇒ Object
Constructor Details
#initialize(data) ⇒ NavOption
Returns a new instance of 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 (readonly)
Returns the value of attribute tag.
4 5 6 |
# File 'lib/argus/nav_option.rb', line 4 def tag @tag end |
Class Method Details
.initial_format ⇒ Object
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 ||= { } 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 = [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) [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 |