Sha256: 3e6b75bb1ba9b5dbf9b76d75c30a65e3b1a532ea497abe23d03f70db3ed970d2
Contents?: true
Size: 831 Bytes
Versions: 2
Compression:
Stored size: 831 Bytes
Contents
# frozen_string_literal: true # All(?) Rack code is namespaced within this module. module Rack # Module includes our middleware components for managing service API versions. module ServiceApiVersioning # Wrapper around JSON encoding of object in environment with defaulted key. class InputEnv DEFAULT_INPUT_KEY = 'COMPONENT_DESCRIPTION' def initialize(env, input_key = DEFAULT_INPUT_KEY) @env = env @key = input_key self end def any? !input_str.empty? end def data JSON.parse input_str, symbolize_names: true end private attr_reader :env, :key def input_str input_value.strip end def input_value env[key].to_s end end # class Rack::ServiceApiVersioning::InputEnv end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rack-service_api_versioning-0.1.1 | lib/rack/service_api_versioning/input_env.rb |
rack-service_api_versioning-0.1.0 | lib/rack/service_api_versioning/input_env.rb |