Skip to content

Commit a941a7f

Browse files
committed
refactor: Move ByteSize module into BinaryParser
1 parent 1e5155d commit a941a7f

File tree

1 file changed

+21
-20
lines changed

1 file changed

+21
-20
lines changed

src/binary_parser.cr

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -259,31 +259,32 @@ class BinaryParser
259259
{% end %}
260260
end
261261
end
262-
end
263262

264-
module ByteSize
265-
macro included
266-
@static_size : Int32?
263+
module ByteSize
264+
macro included
265+
@static_size : Int32?
267266

268-
def bytesize
269-
dyn_size = 0
270-
{% for func in @type.methods %}
271-
{% if func.name.starts_with? "_size_dyn" %}
272-
dyn_size += {{func.name}}
267+
def bytesize
268+
dyn_size = 0
269+
{% for func in @type.methods %}
270+
{% if func.name.starts_with? "_size_dyn" %}
271+
dyn_size += {{func.name}}
272+
{% end %}
273273
{% end %}
274-
{% end %}
275-
static_size + dyn_size
276-
end
274+
static_size + dyn_size
275+
end
277276

278-
private def static_size
279-
return @static_size.not_nil! if @static_size
280-
size = 0
281-
{% for func in @type.methods %}
282-
{% if func.name.starts_with? "_size_static" %}
283-
size += {{func.name}}
277+
private def static_size
278+
return @static_size.not_nil! if @static_size
279+
size = 0
280+
{% for func in @type.methods %}
281+
{% if func.name.starts_with? "_size_static" %}
282+
size += {{func.name}}
283+
{% end %}
284284
{% end %}
285-
{% end %}
286-
@static_size = size
285+
@static_size = size
286+
end
287287
end
288288
end
289289
end
290+

0 commit comments

Comments
 (0)