Skip to content

Instantly share code, notes, and snippets.

@knzconnor
Created March 28, 2010 20:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save knzconnor/346989 to your computer and use it in GitHub Desktop.
Save knzconnor/346989 to your computer and use it in GitHub Desktop.
decomposed methods versus implementation methods
def can_checkout_movie?
account_is_current? &&
available_rental_slots? &&
late_fees_within_limit?
end
def can_checkout_movie?
(Date.today - account.last_membership_renewal_date) > vendor.membership_period &&
movies.currently_checked_out < max_movies_rentable &&
account.late_fees < (account.is_premium? ? vendor.max_late_fees_for_premium_account : vendor.max_late_fees_for_regular_account)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment