class Rack::ServiceApiVersioning::InputEnv
Wrapper around JSON encoding of object in environment with defaulted key.
Constants
- DEFAULT_INPUT_KEY
Attributes
env[R]
key[R]
Public Class Methods
new(env, input_key = DEFAULT_INPUT_KEY)
click to toggle source
# File lib/rack/service_api_versioning/input_env.rb, line 11 def initialize(env, input_key = DEFAULT_INPUT_KEY) @env = env @key = input_key self end
Public Instance Methods
any?()
click to toggle source
# File lib/rack/service_api_versioning/input_env.rb, line 17 def any? !input_str.empty? end
data()
click to toggle source
# File lib/rack/service_api_versioning/input_env.rb, line 21 def data JSON.parse input_str, symbolize_names: true end
Private Instance Methods
input_str()
click to toggle source
# File lib/rack/service_api_versioning/input_env.rb, line 29 def input_str input_value.strip end
input_value()
click to toggle source
# File lib/rack/service_api_versioning/input_env.rb, line 33 def input_value env[key].to_s end