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