class Chronic::Token
Attributes
Public Class Methods
Source
# File lib/chronic/token.rb, line 7 def initialize(word) @word = word @tags = [] end
Public Instance Methods
Source
# File lib/chronic/token.rb, line 38 def get_tag(tag_class) @tags.find { |m| m.kind_of? tag_class } end
tag_class - The tag Class to search for.
Returns The first Tag
that matches the given class.
Source
Source
# File lib/chronic/token.rb, line 31 def tagged? @tags.size > 0 end
Returns true if this token has any tags.
Source
# File lib/chronic/token.rb, line 43 def to_s @word << '(' << @tags.join(', ') << ') ' end
Print this Token
in a pretty way
Source
# File lib/chronic/token.rb, line 26 def untag(tag_class) @tags.delete_if { |m| m.kind_of? tag_class } end
Remove all tags of the given class.
tag_class - The tag Class to remove.
Returns nothing.