Class: MonkeyKing::EnvTag
- Inherits:
-
Object
- Object
- MonkeyKing::EnvTag
- Defined in:
- lib/monkey_king/parser.rb
Instance Attribute Summary collapse
-
#env_tag ⇒ Object
readonly
Returns the value of attribute env_tag.
Instance Method Summary collapse
Instance Attribute Details
#env_tag ⇒ Object (readonly)
Returns the value of attribute env_tag.
37 38 39 |
# File 'lib/monkey_king/parser.rb', line 37 def env_tag @env_tag end |
Instance Method Details
#encode_with(coder) ⇒ Object
51 52 53 54 55 56 57 58 |
# File 'lib/monkey_king/parser.rb', line 51 def encode_with(coder) coder.style = Psych::Nodes::Mapping::FLOW tag=coder.tag.split(':')[2] if ENV[tag].nil? raise "#{tag} not found in env" end coder.scalar = ENV[tag] end |
#init_with(coder) ⇒ Object
45 46 47 48 49 |
# File 'lib/monkey_king/parser.rb', line 45 def init_with( coder ) unless coder.type == :scalar raise "Dunno how to handle #{coder.type} for #{coder.inspect}" end end |
#register(tag) ⇒ Object
39 40 41 42 43 |
# File 'lib/monkey_king/parser.rb', line 39 def register(tag) if tag.split(':')[1] == 'env' self.class.send(:yaml_tag, tag) end end |