class Chronic::Tag

Tokens are tagged with subclassed instances of this class when they match specific criteria.

Attributes

type[RW]

Public Class Methods

new(type, options = {}) click to toggle source

type - The Symbol type of this tag.

# File lib/chronic/tag.rb, line 9
def initialize(type, options = {})
  @type = type
  @options = options
end

Private Class Methods

scan_for(token, klass, items={}, options = {}) click to toggle source
# File lib/chronic/tag.rb, line 22
def scan_for(token, klass, items={}, options = {})
  case items
  when Regexp
    return klass.new(token.word, options) if items =~ token.word
  when Hash
    items.each do |item, symbol|
      return klass.new(symbol, options) if item =~ token.word
    end
  end
  nil
end

Public Instance Methods

start=(time) click to toggle source

time - Set the start Time for this Tag.

# File lib/chronic/tag.rb, line 15
def start=(time)
  @now = time
end