Class: Pdi::Spoon::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/pdi/spoon/options.rb,
lib/pdi/spoon/options/arg.rb,
lib/pdi/spoon/options/level.rb,
lib/pdi/spoon/options/param.rb

Overview

This class serves as the input for executing a transformation or job through Pan or Kitchen.

Defined Under Namespace

Modules: Level, Type Classes: Arg, Param

Constant Summary collapse

TYPES_TO_KEYS =
{
  Type::JOB => Arg::Key::JOB,
  Type::TRANSFORMATION => Arg::Key::TRANS
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(level: Level::BASIC, name:, params: {}, repository:, type:) ⇒ Options

Returns a new instance of Options.

Raises:

  • (ArgumentError)


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# 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

Instance Attribute Details

#levelObject (readonly)

Returns the value of attribute level.



29
30
31
# File 'lib/pdi/spoon/options.rb', line 29

def level
  @level
end

#nameObject (readonly)

Returns the value of attribute name.



29
30
31
# File 'lib/pdi/spoon/options.rb', line 29

def name
  @name
end

#paramsObject (readonly)

Returns the value of attribute params.



29
30
31
# File 'lib/pdi/spoon/options.rb', line 29

def params
  @params
end

#repositoryObject (readonly)

Returns the value of attribute repository.



29
30
31
# File 'lib/pdi/spoon/options.rb', line 29

def repository
  @repository
end

#typeObject (readonly)

Returns the value of attribute type.



29
30
31
# File 'lib/pdi/spoon/options.rb', line 29

def type
  @type
end

Instance Method Details

#to_argsObject



55
56
57
# File 'lib/pdi/spoon/options.rb', line 55

def to_args
  base_args + param_args
end