Sha256: 1148e47a7b408dd261c908e4b455dbf2337db1b3fb03c784388f95d7e7e8f849
Contents?: true
Size: 1.2 KB
Versions: 14
Compression:
Stored size: 1.2 KB
Contents
class RakeCommander module Options module Error # Relates to the `required` parameter when defining an option. class MissingOption < RakeCommander::Options::Error::Base def initialize(value = nil, from: nil) super("missing required option: #{to_message(value)}", from: from) end def options super | to_options(@value) end protected def to_message(value) case value when RakeCommander::Option "#{value.name_hyphen} (#{value.short_hyphen})" when Hash to_message(value.values.uniq) when Array value.map do |v| v.is_a?(RakeCommander::Option)? to_message(v) : v end.join(', ') else super end end private def to_options(value) case value when RakeCommander::Option [value] when Array value.select {|v| v.is_a?(RakeCommander::Option)} when Hash to_options(value.values) else [] end.compact end end end end end
Version data entries
14 entries across 14 versions & 1 rubygems