Skip to content

Commit

Permalink
Update tag.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
erran committed Jun 2, 2014
1 parent c537310 commit c98de1d
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/nexpose/tag.rb
Expand Up @@ -212,12 +212,13 @@ def initialize(name, type, id = -1)

# Set the color but validate it
def color=(hex)
unless Type::Color::constants.include?(hex.to_s.downcase)
raise ArgumentError, "Unable to set color to an invalid color.\nUse one of #{Type::Color::constants}"
end
valid_colors = Type::Color::constants.map { |c| Type::Color.const_get(c) }
unless valid_colors.include?(hex.to_s.downcase)
raise ArgumentError, "Unable to set color to an invalid color.\nUse one of #{valid_colors}"
end

@color = hex
end
@color = hex
end

# Creates and saves a tag to Nexpose console
#
Expand Down

0 comments on commit c98de1d

Please sign in to comment.