Sha256: b89534bf8fe6d31c5f4f4b5c4eda11cb1201a2556d4220b912e78aa18950f236
Contents?: true
Size: 412 Bytes
Versions: 2
Compression:
Stored size: 412 Bytes
Contents
# frozen_string_literal: true module Farseer class Chars include MapFactory def initialize(*chars) @chars = chars.flatten freeze end DIGITS = new(('0'..'9').to_a) BASIC_MATH_OP = new(['+', '-', '*', '/']) def parse(input) case input[0] when *@chars then Maybe.return(Result.new(input[0], input[1..])) else Maybe.none end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
farseer-0.9.0 | lib/farseer/chars.rb |
farseer-0.8.0 | lib/farseer/chars.rb |