Sha256: b02d2b288890b2c9af04d65ab8cb3e49fa02f61918f659ded647e0dd1d50ae48
Contents?: true
Size: 685 Bytes
Versions: 11
Compression:
Stored size: 685 Bytes
Contents
module Ellen class Env module Validatable extend ActiveSupport::Concern module ClassMethods def envs @envs ||= [] end def env(key, description, options = {}) envs << Env.new(key, description, options) end def usage envs.map(&:to_usage).join("\n") end end def validate self.class.envs.each(&:validate) rescue MissingRequiredKeyError => exception raise ValidationError, "#{exception}\n#{self.class.usage}" end def validate! validate rescue ValidationError => exception Ellen.die(exception) end end end end
Version data entries
11 entries across 11 versions & 1 rubygems