class Bindings::HashBinding

An implementation of Bindings::Binding that returns values from a [Hash].

Attributes

name[R]

@!attribute [r] name

@return [String] the name of the binding

Public Class Methods

new(name, content) click to toggle source

Creates a new instance.

@param [String] name the name of the binding @param [Hash<String, String>] content the content of the binding

# File lib/binding.rb, line 162
def initialize(name, content)
  @name = name
  @content = content
end

Public Instance Methods

get_as_bytes(key) click to toggle source

Returns the contents of a binding entry in its raw bytes form.

@param [String] key the key of the entry to retrieve @return [String] the contents of a binding entry if it exists @return [nil]

# File lib/binding.rb, line 172
def get_as_bytes(key)
  return nil unless Bindings.valid_secret_key?(key)
  return nil unless @content.key?(key)

  @content[key]
end