Sha256: 9120e6694d689312b8c806d6599b54a80035555afa50dd15d188e48b64544f3a
Contents?: true
Size: 563 Bytes
Versions: 22
Compression:
Stored size: 563 Bytes
Contents
module Ruboty class Env attr_reader :key, :description, :options def initialize(key, description, options = {}) @key = key.to_s @description = description @options = options end def validate error if required? && missing? end def to_usage " %-30s - %s" % [key, description] end private def required? !options[:optional] end def missing? !ENV[key] end def error raise MissingRequiredKeyError, %<ENV["#{key}"] is required but missing> end end end
Version data entries
22 entries across 22 versions & 1 rubygems