Sha256: 2ec1e7e528831d97760ce3b5461d3b5e8f492c4bda6ca4db9c5f30961ed4bb6c
Contents?: true
Size: 1.2 KB
Versions: 57
Compression:
Stored size: 1.2 KB
Contents
module Henry # Henry Input class Input attr_reader :params # ENV key where the Input will be exported to/imported from. EXPORT_KEY = 'HENRY_INPUT' # Initialize the Input with the given params or empty. # # @param params [Hash] the Input params. def initialize(params={}) @params = params end # Initialize and export the Input to the target ENV namespace. # # @param params [Hash] the Input params to be exported. # @return [Input] def self.export!(params) self.new(params).export! end # Exports the Input to the target ENV namespace. # # @return [Input] def export! ENV[EXPORT_KEY] = JSON.dump(@params) self end # Initialize and import the Input from the target ENV namespece. # # @return [Input] def self.import! self.new.import! end # Imports the Input from the target ENV namespace. # # @return [Input] def import! if ENV[EXPORT_KEY] @params = JSON.parse(ENV[EXPORT_KEY]) else warn("Could not load the execution params.\nAre you running this Task via the henry-ruby-container? You should!".red) end self end end end
Version data entries
57 entries across 57 versions & 1 rubygems