Class: Exerb::Resource::VersionInfo::BlockBase
- Inherits:
-
Object
- Object
- Exerb::Resource::VersionInfo::BlockBase
- Defined in:
- lib/exerb/resource/version_info.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#children ⇒ Object
Returns the value of attribute children.
-
#key ⇒ Object
Returns the value of attribute key.
-
#type ⇒ Object
Returns the value of attribute type.
-
#unicode ⇒ Object
Returns the value of attribute unicode.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #<<(child) ⇒ Object
-
#initialize(type, key, value = '', unicode = false) {|_self| ... } ⇒ BlockBase
constructor
A new instance of BlockBase.
- #pack ⇒ Object
Constructor Details
#initialize(type, key, value = '', unicode = false) {|_self| ... } ⇒ BlockBase
Returns a new instance of BlockBase.
97 98 99 100 101 102 103 104 105 |
# File 'lib/exerb/resource/version_info.rb', line 97 def initialize(type, key, value = '', unicode = false) @type = type @key = key @value = value @unicode = unicode @children = [] yield(self) if block_given? end |
Instance Attribute Details
#children ⇒ Object
Returns the value of attribute children.
107 108 109 |
# File 'lib/exerb/resource/version_info.rb', line 107 def children @children end |
#key ⇒ Object
Returns the value of attribute key.
107 108 109 |
# File 'lib/exerb/resource/version_info.rb', line 107 def key @key end |
#type ⇒ Object
Returns the value of attribute type.
107 108 109 |
# File 'lib/exerb/resource/version_info.rb', line 107 def type @type end |
#unicode ⇒ Object
Returns the value of attribute unicode.
107 108 109 |
# File 'lib/exerb/resource/version_info.rb', line 107 def unicode @unicode end |
#value ⇒ Object
Returns the value of attribute value.
107 108 109 |
# File 'lib/exerb/resource/version_info.rb', line 107 def value @value end |
Instance Method Details
#<<(child) ⇒ Object
109 110 111 |
# File 'lib/exerb/resource/version_info.rb', line 109 def <<(child) @children << child end |
#pack ⇒ Object
113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/exerb/resource/version_info.rb', line 113 def pack packed_children = @children.collect { |child| child.pack }.join block = Exerb::Win32::Struct::VersionInfoBlock.new block.type = @type block.key = @key.unpack("U*").pack("v*") # UTF-8 to UTF-16LE block.data = @value block.value_length = (@unicode ? @value.size / 2 : @value.size) block.total_length = block.pack.size + packed_children.size return Exerb::Utility.alignment(block.pack, 4) + packed_children end |