Class: Chronic::Tag

Inherits:
Object
  • Object
show all
Defined in:
lib/chronic/tag.rb

Overview

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

Direct Known Subclasses

Grabber, Ordinal, Pointer, Repeater, Scalar, Separator, Sign, TimeZone

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type, width = nil, options = {}) ⇒ Tag

type - The Symbol type of this tag.



10
11
12
13
14
# File 'lib/chronic/tag.rb', line 10

def initialize(type, width = nil, options = {})
  @type = type
  @width = width
  @options = options
end

Instance Attribute Details

#typeObject

Returns the value of attribute type.



6
7
8
# File 'lib/chronic/tag.rb', line 6

def type
  @type
end

#widthObject

Returns the value of attribute width.



7
8
9
# File 'lib/chronic/tag.rb', line 7

def width
  @width
end

Class Method Details

.scan(tokens, options) ⇒ Object

Public: Scan an Array of Token objects.

tokens - An Array of tokens to scan. options - The Hash of options specified in Chronic::parse.

Returns an Array of tokens.

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/chronic/tag.rb', line 28

def scan(tokens, options)
  raise NotImplementedError, 'Subclasses must override scan!'
end

Instance Method Details

#start=(time) ⇒ Object

time - Set the start Time for this Tag.



17
18
19
# File 'lib/chronic/tag.rb', line 17

def start=(time)
  @now = time
end