Browse Source

Fix up documentation for that.

Douglas Thrift 10 years ago
parent
commit
88af77494a
1 changed files with 7 additions and 0 deletions
  1. 7 0
      lib/machine_tag/tag.rb

+ 7 - 0
lib/machine_tag/tag.rb

@@ -2,11 +2,16 @@ module MachineTag
   # A tag which can be a machine tag.
   #
   class Tag < String
+    # The regular expression for matching the namespace and predicate portions of a machine tag
+    #
+    # @return [Regexp] the regular expression for matching the namespace and predicate portions of a machine tag
+    #
     PREFIX = /[a-z][a-z0-9_]*/i
 
     # The regular expression for matching a machine tag
     #
     # @return [Regexp] the regular expression for matching a machine tag
+    #
     MACHINE_TAG = /^(?<namespace>#{PREFIX}):(?<predicate>#{PREFIX})=(?<value>.*)$/
 
     # The namespace portion of the machine tag, +nil+ if the tag is not a machine tag
@@ -51,6 +56,8 @@ module MachineTag
     #
     # @return [Tag] the machine tag
     #
+    # @raise [ArgumentError] if the +namespace+ or +predicate+ are not in the correct format
+    #
     def self.machine_tag(namespace, predicate, value, options = {})
       raise ArgumentError, "Invalid machine tag namespace: #{namespace.inspect}" unless namespace =~ /^#{PREFIX}$/
       raise ArgumentError, "Invalid machine tag predicate: #{predicate.inspect}" unless predicate =~ /^#{PREFIX}$/