module OpenProject::Token::Armor
Constants
- MARKER
Public Class Methods
decode(data)
click to toggle source
# File lib/open_project/token/armor.rb, line 27 def decode(data) match = data.match /#{header}\r?\n(.+?)\r?\n#{footer}/m if match.nil? raise ParseError, 'Failed to parse armored text.' end match[1] end
encode(data)
click to toggle source
# File lib/open_project/token/armor.rb, line 17 def encode(data) ''.tap do |s| s << header << "\n" s << data.strip << "\n" s << footer end end
header()
click to toggle source
# File lib/open_project/token/armor.rb, line 9 def header "-----BEGIN #{MARKER}-----" end