Created
October 27, 2012 20:52
-
-
Save cheald/3966197 to your computer and use it in GitHub Desktop.
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
class User | |
FILLABLE_ATTRIBUTES = [:name, :age, :sex] | |
def profile_percent_complete | |
FILLABLE_ATTRIBUTES.inject(0) {|c, u| c += send(u).present? && 1 || 0 } / FILLABLE_ATTRIBUTES.length.to_f | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment