DSL to build "Pack Template Format(for Array#pack, String#unpack)"
- Builder
- Parser
- Pure Ruby :)
require 'packtemplate'
template = PackTemplate.build do
unsigned_char :infinite
uint16_t
ber_compressed_int 5
end
p template #=> "C*S1w5"
summary = PackTemplate.summarize(template)
puts summary #=> unsigned_char :infinite
# uint16_t 1
# ber_compressed_int 5
p PackTemplate.for_summary(summary) #=> "C*S1w5"
- Ruby - 1.9.3 or later
gem install packtemplate
The MIT X11 License
Copyright (c) 2013 Kenichi Kamiya
See MIT-LICENSE for further details.