Sha256: 7cceee02b20c9d53425eb159fc3274dd61719b8ec78398d71b7ef9f4a6b0e7ce
Contents?: true
Size: 588 Bytes
Versions: 1
Compression:
Stored size: 588 Bytes
Contents
grammar Timeparsing rule root (dot_seperated / hours / minutes)* { def value self.elements.inject(0) {|akk, e| akk += e.value; akk } end } end rule dot_seperated [0-9]* ':' [0-9]* { def value elements[0].text_value.to_i*60 + elements[2].text_value.to_i end } end rule hours ([0-9]* 'h' / 'hours') { def value self.text_value.to_i * 60 end } end rule minutes ( [0-9]* "m" / "min" / "minutes" ) { def value self.text_value.to_i end } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
timeparser-0.0.1 | lib/timeparser/timeparsing.treetop |