class Pdi::Spoon::Options
This class serves as the input for executing a transformation or job through Pan or Kitchen.
Constants
- TYPES_TO_KEYS
Attributes
level[R]
name[R]
params[R]
repository[R]
type[R]
Public Class Methods
new( level: Level::BASIC, name:, params: {}, repository:, type: )
click to toggle source
# File lib/pdi/spoon/options.rb, line 35 def initialize( level: Level::BASIC, name:, params: {}, repository:, type: ) raise ArgumentError, 'name is required' if name.to_s.empty? raise ArgumentError, 'repository is required' if repository.to_s.empty? raise ArgumentError, 'type is required' if type.to_s.empty? @level = constant(Level, level) @name = name.to_s @params = params || {} @repository = repository.to_s @type = constant(Type, type) freeze end
Public Instance Methods
to_args()
click to toggle source
# File lib/pdi/spoon/options.rb, line 55 def to_args base_args + param_args end
Private Instance Methods
base_args()
click to toggle source
# File lib/pdi/spoon/options.rb, line 65 def base_args [ Arg.new(Arg::Key::REP, repository), Arg.new(key, name), Arg.new(Arg::Key::LEVEL, level) ] end
constant(constant, value)
click to toggle source
# File lib/pdi/spoon/options.rb, line 77 def constant(constant, value) constant.const_get(value.to_s.upcase.to_sym) end
key()
click to toggle source
# File lib/pdi/spoon/options.rb, line 61 def key TYPES_TO_KEYS.fetch(type) end
param_args()
click to toggle source
# File lib/pdi/spoon/options.rb, line 73 def param_args params.map { |key, value| Param.new(key, value) } end