Class: Hiera::Backend::Eyaml::Parser::DecBlockTokenType

Inherits:
TokenType
  • Object
show all
Defined in:
lib/hiera/backend/eyaml/parser/encrypted_tokens.rb

Instance Attribute Summary

Attributes inherited from TokenType

#regex

Instance Method Summary collapse

Constructor Details

#initializeDecBlockTokenType

Returns a new instance of DecBlockTokenType.


125
126
127
# File 'lib/hiera/backend/eyaml/parser/encrypted_tokens.rb', line 125

def initialize
  @regex = />\n(\s*)DEC(\(\d+\))?::(\w+)\[(.+?)\]\!/m
end

Instance Method Details

#create_token(string) ⇒ Object


128
129
130
131
132
# File 'lib/hiera/backend/eyaml/parser/encrypted_tokens.rb', line 128

def create_token(string)
  md = @regex.match(string)
  EncToken.decrypted_value(:block, md[4], md[3], string, md[2], md[1])
  EncToken.decrypted_value(:block, md[4], md[3], string, md[2], md[1])
end