Class: GameValidator::Validator::Result

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/game_validator/validator/result.rb,
lib/game_validator/validator/result/failure.rb,
lib/game_validator/validator/result/failure/node.rb,
lib/game_validator/validator/result/failure/builder.rb

Defined Under Namespace

Classes: Failure

Instance Method Summary collapse

Constructor Details

#initialize(result:, execute:) ⇒ Result

Returns a new instance of Result.



10
11
12
13
# File 'lib/game_validator/validator/result.rb', line 10

def initialize(result:, execute:)
  super(Types.Interface(:failure?, :success?, :to_h).call(result))
  @execute = Types.Interface(:call).call(execute)
end

Instance Method Details

#call(**args) ⇒ Object



15
16
17
# File 'lib/game_validator/validator/result.rb', line 15

def call(**args)
  @execute.(to_h.merge(args))
end