Class: Zakuro::Parameter::Catalog::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/zakuro/parameter/catalog/option.rb

Overview

Option オプション取得内容を変更する

* version: 

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options: []) ⇒ Option

初期化

Parameters:

  • options (Hash<Symbol, Object>) (defaults to: [])

    オプション



28
29
30
# File 'lib/zakuro/parameter/catalog/option.rb', line 28

def initialize(options: [])
  @options = options
end

Instance Attribute Details

#optionsArray<String> (readonly)

Returns オプション.

Returns:

  • (Array<String>)

    オプション



21
22
23
# File 'lib/zakuro/parameter/catalog/option.rb', line 21

def options
  @options
end

Class Method Details

.validate(options:) ⇒ Array<Exception::Case::Preset>

検証する

Parameters:

  • options (Hash<Symbol, Object>)

    オプション

Returns:



42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/zakuro/parameter/catalog/option.rb', line 42

def validate(options:)
  failed = []
  return failed unless options

  return failed if options.is_a?(Hash)

  failed.push(
    Exception::Case::Preset.new(
      hash.class,
      template: Exception::Case::Pattern::INVALID_OPTION_TYPE
    )
  )
  failed
end