Sha256: f26f6d4701bcd98503b5ebabcf4a96e8100a3d419e0dfa09772995854f7cac2a
Contents?: true
Size: 1.21 KB
Versions: 1
Compression:
Stored size: 1.21 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
henry-container-0.1.45 | lib/henry/input.rb |