lib/chronic/token.rb in chronic-0.6.7 vs lib/chronic/token.rb in chronic-0.7.0
- old
+ new
@@ -1,39 +1,41 @@
module Chronic
class Token
- # @return [String] The word this Token represents
attr_accessor :word
-
- # @return [Array] A list of tag associated with this Token
attr_accessor :tags
def initialize(word)
@word = word
@tags = []
end
- # Tag this token with the specified tag
+ # Tag this token with the specified tag.
#
- # @param [Tag] new_tag An instance of {Tag} or one of its subclasses
+ # new_tag - The new Tag object.
+ #
+ # Returns nothing.
def tag(new_tag)
@tags << new_tag
end
- # Remove all tags of the given class
+ # Remove all tags of the given class.
#
- # @param [Class] The tag class to remove
+ # tag_class - The tag Class to remove.
+ #
+ # Returns nothing.
def untag(tag_class)
@tags.delete_if { |m| m.kind_of? tag_class }
end
- # @return [Boolean] true if this token has any tags
+ # Returns true if this token has any tags.
def tagged?
@tags.size > 0
end
- # @param [Class] tag_class The tag class to search for
- # @return [Tag] The first Tag that matches the given class
+ # tag_class - The tag Class to search for.
+ #
+ # Returns The first Tag that matches the given class.
def get_tag(tag_class)
@tags.find { |m| m.kind_of? tag_class }
end
# Print this Token in a pretty way
\ No newline at end of file