Skip to content

Instantly share code, notes, and snippets.

@apeiros

apeiros/foo.rb Secret

Last active January 30, 2017 20:33
Show Gist options
  • Save apeiros/ac150d8a32b5a6f6f7fa952dbecfb31a to your computer and use it in GitHub Desktop.
Save apeiros/ac150d8a32b5a6f6f7fa952dbecfb31a to your computer and use it in GitHub Desktop.
AllowedTypes = %i[query commit].to_set
private def assert_valid_tx_type(tx_type)
unless valid_tx_type?(tx_type)
raise ArgumentError, "tx_type must be one of the following: #{AllowedTypes.inspect[1..-2]}"
end
end
private def valid_tx_type?(tx_type)
AllowedTypes.include?(tx_type)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment