26 lines
426 B
Crystal
26 lines
426 B
Crystal
class Zone
|
|
property tag : String
|
|
property content : Array(String)
|
|
|
|
def initialize(@tag = "", @content = [] of String)
|
|
end
|
|
|
|
def token_count()
|
|
token_count = 0
|
|
|
|
self.each do |content|
|
|
token_count += content.size / 4
|
|
end
|
|
|
|
return token_count
|
|
end
|
|
|
|
def each(&block)
|
|
content.each { |item| yield item }
|
|
end
|
|
|
|
def reverse_each(&block)
|
|
content.reverse_each { |item| yield item }
|
|
end
|
|
end
|
|
|