Class: Ree::Contracts::ArgContracts::Kwargs
- Defined in:
- lib/ree/contracts/arg_contracts/kwargs.rb
Instance Attribute Summary collapse
-
#contracts ⇒ Object
readonly
Returns the value of attribute contracts.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**contracts) ⇒ Kwargs
constructor
A new instance of Kwargs.
Constructor Details
#initialize(**contracts) ⇒ Kwargs
Returns a new instance of Kwargs.
16 17 18 19 |
# File 'lib/ree/contracts/arg_contracts/kwargs.rb', line 16 def initialize(**contracts) @contracts = contracts super(contracts) end |
Instance Attribute Details
#contracts ⇒ Object (readonly)
Returns the value of attribute contracts.
14 15 16 |
# File 'lib/ree/contracts/arg_contracts/kwargs.rb', line 14 def contracts @contracts end |
Class Method Details
.[](**contracts) ⇒ Object
6 7 8 9 10 11 12 |
# File 'lib/ree/contracts/arg_contracts/kwargs.rb', line 6 def self.[](**contracts) if contracts.empty? raise BadContractError, 'Kwargs contract should accept at least one contract' end new(**contracts) end |