Sha256: ae929c1954ab2b5b6cf3fa7f07ae735e061939327fbd447f3d928f4100b52e49
Contents?: true
Size: 728 Bytes
Versions: 3
Compression:
Stored size: 728 Bytes
Contents
module Chronic class Pointer < Tag # Scan an Array of {Token}s and apply any necessary Pointer tags to # each token # # @param [Array<Token>] tokens Array of tokens to scan # @param [Hash] options Options specified in {Chronic.parse} # @return [Array] list of tokens def self.scan(tokens, options) tokens.each do |token| if t = scan_for_all(token) then token.tag(t) end end end # @param [Token] token # @return [Pointer, nil] def self.scan_for_all(token) scan_for token, self, { /\bpast\b/ => :past, /\bfuture\b/ => :future, /\bin\b/ => :future } end def to_s 'pointer-' << @type.to_s end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
chronic-0.5.0 | lib/chronic/pointer.rb |
chronic-0.4.4 | lib/chronic/pointer.rb |
chronic-0.4.3 | lib/chronic/pointer.rb |