Module: Contracts::CallWith
- Included in:
- Contract
- Defined in:
- lib/contracts/contract/call_with.rb
Constant Summary collapse
- SILENT_FAILURE =
"silent_failure".freeze
Instance Method Summary collapse
Instance Method Details
#call_with(this, *args, &blk) ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/contracts/contract/call_with.rb', line 4 def call_with(this, *args, &blk) args << blk if blk nil_block_appended = maybe_append_block!(args, blk) (args, blk) return if SILENT_FAILURE == catch(:return) do args_validator.validate_args_before_splat!(args) end return if SILENT_FAILURE == catch(:return) do args_validator.validate_splat_args_and_after!(args) end handle_result(this, args, blk, nil_block_appended) end |