Sha256: e8cd8cae44c689e1048328eca859fd0635f44aacd77d97289d0bb0feef1531ea
Contents?: true
Size: 741 Bytes
Versions: 2
Compression:
Stored size: 741 Bytes
Contents
module Copyable class OptionChecker VALID_OPTIONS = [:override, :skip_validations] VALID_PRIVATE_OPTIONS = [:__called_recursively] # for copyable's internal use only def self.check!(options) unrecognized_options = options.keys - VALID_OPTIONS - VALID_PRIVATE_OPTIONS if unrecognized_options.any? message = "Unrecognized options passed to create_copy!:\n" unrecognized_options.each do |opt| message << " #{opt.inspect}\n" end message << "The options passed to create_copy! can only be one of the following:\n" VALID_OPTIONS.each do |opt| message << " #{opt.inspect}\n" end raise CopyableError.new(message) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
copyable-0.0.2 | lib/copyable/option_checker.rb |
copyable-0.0.1 | lib/copyable/option_checker.rb |