Class: Zippo::BinaryStructure::StructureMember
- Inherits:
-
Object
- Object
- Zippo::BinaryStructure::StructureMember
- Defined in:
- lib/zippo/binary_structure/structure_member.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#pack ⇒ Object
readonly
Returns the value of attribute pack.
-
#width ⇒ Object
readonly
XXX unspec.
Class Method Summary collapse
Instance Method Summary collapse
-
#dependent ⇒ Object
XXX unspec.
-
#initialize(name, pack, options = {}) ⇒ StructureMember
constructor
A new instance of StructureMember.
- #signature? ⇒ Boolean
Constructor Details
#initialize(name, pack, options = {}) ⇒ StructureMember
Returns a new instance of StructureMember.
4 5 6 7 8 9 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 4 def initialize(name, pack, = {}) @name = name @pack = pack @options = @width = StructureMember.width(@pack) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
24 25 26 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 24 def name @name end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
24 25 26 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 24 def @options end |
#pack ⇒ Object (readonly)
Returns the value of attribute pack.
24 25 26 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 24 def pack @pack end |
#width ⇒ Object (readonly)
XXX unspec
15 16 17 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 15 def width @width end |
Class Method Details
.width(pack) ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 16 def self.width(pack) case pack when 'L' then 4 when 'S' then 2 when /^a(\d+)$/ then Regexp.last_match[1].to_i when 'a*' then nil end end |
Instance Method Details
#dependent ⇒ Object
XXX unspec
11 12 13 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 11 def dependent [:size] end |
#signature? ⇒ Boolean
26 27 28 |
# File 'lib/zippo/binary_structure/structure_member.rb', line 26 def signature? [:signature] end |