Looking to write a Tag class
- by Austin Schneider
I'm looking to write a Tag class (a tag is a string with no spaces). My first thought is to inherit from String:
class Tag < String
def initialize(str)
raise ArgumentError if str =~ /\s/
super
end
end
Does this look correct? Are there any other methods I should redefine?