Skip to content

Instantly share code, notes, and snippets.

@taylor-smith
Created September 25, 2013 19:37
Show Gist options
  • Save taylor-smith/6704904 to your computer and use it in GitHub Desktop.
Save taylor-smith/6704904 to your computer and use it in GitHub Desktop.
def initialize (args={:event_time, :deadline, :event_name, :event_location, :minimum_attendees, :maximum_attendees, :creator_name, :phone, :email, :invitees})
@required = args.fetch(:event_time, :deadline, :minimum_attendees) # .fetch will throw an error if key doesn't exist in Hash
@optional = args[:creator, :event_name, :event_location, :attendees, :maximum_attendees] # simple access returns nil if key isn't set--no exception raised
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment