class SabayonMiddleware::Pairs
Attributes
variables[R]
Public Class Methods
call(variables = ENV)
click to toggle source
# File lib/sabayon_middleware/pairs.rb, line 2 def self.call(variables = ENV) new(variables).call end
new(variables)
click to toggle source
# File lib/sabayon_middleware/pairs.rb, line 6 def initialize(variables) @variables = variables end
Public Instance Methods
call()
click to toggle source
# File lib/sabayon_middleware/pairs.rb, line 10 def call if single_pair? return {variables["ACME_TOKEN"] => variables["ACME_KEY"]} end token_variables.inject({}) do |hash, (key, value)| index = key.match(/^ACME_TOKEN_([0-9]+)/)[1] hash[value] = variables["ACME_KEY_#{index}"] hash end end
Private Instance Methods
single_pair?()
click to toggle source
# File lib/sabayon_middleware/pairs.rb, line 27 def single_pair? variables["ACME_KEY"] && variables["ACME_TOKEN"] end
token_variables()
click to toggle source
# File lib/sabayon_middleware/pairs.rb, line 31 def token_variables variables.inject({}) do |hash, (key, value)| hash[key] = value if key[/^ACME_TOKEN_([0-9]+)/] hash end end