Class: Chronic::Tag
- Inherits:
-
Object
- Object
- Chronic::Tag
- Defined in:
- lib/chronic/tag.rb
Overview
Tokens are tagged with subclassed instances of this class when they match specific criteria.
Instance Attribute Summary collapse
-
#type ⇒ Object
Returns the value of attribute type.
-
#width ⇒ Object
Returns the value of attribute width.
Class Method Summary collapse
-
.scan(tokens, options) ⇒ Object
Public: Scan an Array of Token objects.
Instance Method Summary collapse
-
#initialize(type, width = nil, options = {}) ⇒ Tag
constructor
type - The Symbol type of this tag.
-
#start=(time) ⇒ Object
time - Set the start Time for this Tag.
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, = {}) @type = type @width = width @options = end |
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type.
6 7 8 |
# File 'lib/chronic/tag.rb', line 6 def type @type end |
#width ⇒ Object
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.
28 29 30 |
# File 'lib/chronic/tag.rb', line 28 def scan(tokens, ) 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 |