Module: BCDD::Value::Properties::Contract
- Defined in:
- lib/bcdd/ext/value.rb
Class Method Summary collapse
Class Method Details
.[](options) ⇒ Object
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/bcdd/ext/value.rb', line 21 def self.[]() contract = compose() required = .fetch(:required, true) if contract required ? contract : (contract | nil) elsif required Contracts::NotNil end end |
.compose(options) ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/bcdd/ext/value.rb', line 32 def self.compose() type = ::BCDD::Contract.type([:type]) if .key?(:type) contract = ::BCDD::Contract[[:contract]] if .key?(:contract) respond_to = ::BCDD::Contract.respond_to(Array([:respond_to])) if .key?(:respond_to) [type, contract, respond_to].compact!&.reduce(:&) end |