Class: Nero::Context
- Inherits:
-
Object
- Object
- Nero::Context
- Defined in:
- lib/nero/context.rb
Instance Attribute Summary collapse
-
#dir ⇒ Object
readonly
Returns the value of attribute dir.
-
#environ ⇒ Object
readonly
Returns the value of attribute environ.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#warnings ⇒ Object
readonly
Returns the value of attribute warnings.
Instance Method Summary collapse
- #add_error(message) ⇒ Object
- #add_warning(message) ⇒ Object
-
#all_optional? ⇒ Boolean
True when missing values (env vars, credentials) resolve to nil instead of being an error.
- #deprecate(msg, use: nil, removed_in: "1.0") ⇒ Object
-
#initialize(environ:, dir: nil, all_optional: false) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(environ:, dir: nil, all_optional: false) ⇒ Context
Returns a new instance of Context.
7 8 9 10 11 12 13 |
# File 'lib/nero/context.rb', line 7 def initialize(environ:, dir: nil, all_optional: false) @environ = environ @dir = dir || File.realpath(".") @all_optional = all_optional @errors = [] @warnings = Set.new end |
Instance Attribute Details
#dir ⇒ Object (readonly)
Returns the value of attribute dir.
5 6 7 |
# File 'lib/nero/context.rb', line 5 def dir @dir end |
#environ ⇒ Object (readonly)
Returns the value of attribute environ.
5 6 7 |
# File 'lib/nero/context.rb', line 5 def environ @environ end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
5 6 7 |
# File 'lib/nero/context.rb', line 5 def errors @errors end |
#warnings ⇒ Object (readonly)
Returns the value of attribute warnings.
5 6 7 |
# File 'lib/nero/context.rb', line 5 def warnings @warnings end |
Instance Method Details
#add_error(message) ⇒ Object
19 20 21 |
# File 'lib/nero/context.rb', line 19 def add_error() @errors << Error.new() end |
#add_warning(message) ⇒ Object
23 24 25 |
# File 'lib/nero/context.rb', line 23 def add_warning() @warnings << end |
#all_optional? ⇒ Boolean
True when missing values (env vars, credentials) resolve to nil instead of being an error. See Parser#initialize (all_optional:).
17 |
# File 'lib/nero/context.rb', line 17 def all_optional? = @all_optional |
#deprecate(msg, use: nil, removed_in: "1.0") ⇒ Object
27 28 29 |
# File 'lib/nero/context.rb', line 27 def deprecate(msg, use: nil, removed_in: "1.0") add_warning "DEPRECATION WARNING: #{msg} and will be removed in #{removed_in} (use #{use})" end |