Class: Zakuro::Exception::Case::Preset

Inherits:
Object
  • Object
show all
Defined in:
lib/zakuro/exception/case/preset.rb

Overview

Preset プリセット

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, template:) ⇒ Preset

初期化



26
27
28
29
# File 'lib/zakuro/exception/case/preset.rb', line 26

def initialize(*args, template:)
  @template = template
  @args = args
end

Instance Attribute Details

#argsArray<Object> (readonly)



18
19
20
# File 'lib/zakuro/exception/case/preset.rb', line 18

def args
  @args
end

#templateTemplate (readonly)



16
17
18
# File 'lib/zakuro/exception/case/preset.rb', line 16

def template
  @template
end

Instance Method Details

#codeString

エラーコードを取得する



36
37
38
# File 'lib/zakuro/exception/case/preset.rb', line 36

def code
  template.code
end

#messageString

メッセージを作成する



45
46
47
# File 'lib/zakuro/exception/case/preset.rb', line 45

def message
  template.format(*args)
end