class Chronic::Token
def get_tag(tag_class)
-
(Tag)
- The first Tag that matches the given class
Parameters:
-
tag_class
(Class
) -- The tag class to search for
def get_tag(tag_class) @tags.find { |m| m.kind_of? tag_class } end
def initialize(word)
def initialize(word) @word = word @tags = [] end
def tag(new_tag)
-
new_tag
(Tag
) -- A instance of {Tag} or one of its subclasses
def tag(new_tag) @tags << new_tag end
def tagged?
-
(Boolean)
- true if this token has any tags
def tagged? @tags.size > 0 end
def to_s
def to_s @word << '(' << @tags.join(', ') << ') ' end
def untag(tag_class)
-
The
(Class
) -- tag class to remove
def untag(tag_class) @tags.delete_if { |m| m.kind_of? tag_class } end