Class: YamlEnvTag::EnvVariable
- Inherits:
-
String
- Object
- String
- YamlEnvTag::EnvVariable
- Defined in:
- lib/yaml_env_tag/env_variable.rb
Overview
A specialized String that holds a value of environment variable specified by !ENV tag.
Instance Method Summary collapse
-
#init_with(coder) ⇒ Object
Deserializes from YAML.
Instance Method Details
#init_with(coder) ⇒ Object
Deserializes from YAML. This method is called by Psych.
14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/yaml_env_tag/env_variable.rb', line 14 def init_with(coder) *variables, default = case coder.type when :scalar [coder.scalar, nil] when :seq coder.seq.size < 2 ? [*coder.seq, nil] : coder.seq else raise InvalidUsageError, "#{coder.tag} tag cannot be used on a #{coder.type} node" end initialize(variables, default) end |