Class: Ellen::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/ellen/env.rb,
lib/ellen/env/validatable.rb,
lib/ellen/env/validation_error.rb,
lib/ellen/env/missing_required_key_error.rb

Defined Under Namespace

Modules: Validatable Classes: MissingRequiredKeyError, ValidationError

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, description, options = {}) ⇒ Env

Returns a new instance of Env.



5
6
7
8
9
# File 'lib/ellen/env.rb', line 5

def initialize(key, description, options = {})
  @key = key.to_s
  @description = description
  @options = options
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



3
4
5
# File 'lib/ellen/env.rb', line 3

def description
  @description
end

#keyObject (readonly)

Returns the value of attribute key.



3
4
5
# File 'lib/ellen/env.rb', line 3

def key
  @key
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/ellen/env.rb', line 3

def options
  @options
end

Instance Method Details

#to_usageObject



15
16
17
# File 'lib/ellen/env.rb', line 15

def to_usage
  "    %-30s - %s" % [key, description]
end

#validateObject



11
12
13
# File 'lib/ellen/env.rb', line 11

def validate
  error if required? && missing?
end