This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def build_message | |
message = PORTFOLIO_FIELDS.graph{|field, _| [field, send(field)] } | |
self.message = message.delete_if { |_, value| value.nil? } | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
count = 90 | |
total = 100 | |
%w(red amber green).map.with_index do |color, index| | |
color if ((index + 1)/ 3.0) > (count.to_f / total.to_f) | |
end.compact.first |