#11 Refactoring User Name Part 2

def full_name
  [first_name, middle_initial_with_period, last_name].compact.join(' ')
end

def middle_initial_with_period
  "#{middle_initial}." unless middle_initial.blank?
end

你可能感兴趣的:(Ruby,Rails)