Extract the keyword and the value. The assumptions are that the keyword or attribute is a single word, the value extends to the end of the line, and the equal sign may be surrounded by whitespace.
#!/usr/local/bin/ruby
# The following extracts the keyword and the value. The
# assumptions are that the keyword or attribute is a single
# word, the value extends to the end of the line, and the equal
# sign may be surrounded by whitespace.
pat = /(\w+)\s*=\s*(.*?)$/
str = "color = red"
matches = pat.match(str)
puts matches[0] # "color"
puts matches[1] # "color"
puts matches[2] # "red"