Sha256: 74cb7582e28039f8655344620fecab8535f216fc292fed7b77abaae7abc8d7be

Contents?: true

Size: 634 Bytes

Versions: 3

Compression:

Stored size: 634 Bytes

Contents

module Chronic
  class Grabber < Tag

    # Scan an Array of Tokens and apply any necessary Grabber tags to
    # each token.
    #
    # tokens  - An Array of Token objects to scan.
    # options - The Hash of options specified in Chronic::parse.
    #
    # Returns an Array of Token objects.
    def self.scan(tokens, options)
      tokens.each do |token|
        token.tag scan_for(token, self, patterns, options)
      end
    end

    def self.patterns
      @@patterns ||= {
        'last' => :last,
        'this' => :this,
        'next' => :next
      }
    end

    def to_s
      'grabber-' << @type.to_s
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
gitlab-chronic-0.10.4 lib/chronic/tags/grabber.rb
gitlab-chronic-0.10.3 lib/chronic/tags/grabber.rb
chronic-davispuh-0.10.2.v0.1da32066b3f46f2506b3471e39557497e34afa27 lib/chronic/tags/grabber.rb