Class: Ellen::Env
- Inherits:
-
Object
- Object
- Ellen::Env
- 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
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(key, description, options = {}) ⇒ Env
constructor
A new instance of Env.
- #to_usage ⇒ Object
- #validate ⇒ Object
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, = {}) @key = key.to_s @description = description @options = end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
3 4 5 |
# File 'lib/ellen/env.rb', line 3 def description @description end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
3 4 5 |
# File 'lib/ellen/env.rb', line 3 def key @key end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/ellen/env.rb', line 3 def @options end |
Instance Method Details
#to_usage ⇒ Object
15 16 17 |
# File 'lib/ellen/env.rb', line 15 def to_usage " %-30s - %s" % [key, description] end |
#validate ⇒ Object
11 12 13 |
# File 'lib/ellen/env.rb', line 11 def validate error if required? && missing? end |