Sha256: f06c2bbd0150224fe3d1b5e4dc91f3ea76cd8d2bcb77eeee628bd35405f8d319
Contents?: true
Size: 498 Bytes
Versions: 2
Compression:
Stored size: 498 Bytes
Contents
module RequiredOptions VERSION = '0.5.0' def required_options(options, *required_options) included_opts, missing_opts = required_options.partition do |o| options.include?(o) end raise MissingOptions, exception_text_for(missing_opts) if !missing_opts.empty? end private def exception_text_for(missing_options) missing_options.map(&:inspect).join(", ").gsub("\"", "") end end class Object include RequiredOptions end class MissingOptions < ArgumentError; end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
required_options-0.6.0 | lib/required_options.rb |
required_options-0.5.0 | lib/required_options.rb |