Module: DriedInteraction::Dsl
- Defined in:
- lib/dried_interaction/dsl.rb
Constant Summary collapse
- MODES =
%i[strict soft].freeze
Instance Attribute Summary collapse
-
#contract_mode ⇒ Object
Returns the value of attribute contract_mode.
-
#contract_validator ⇒ Object
Returns the value of attribute contract_validator.
-
#for_method ⇒ Object
Returns the value of attribute for_method.
Instance Method Summary collapse
- #contract(kind: :simple, mode: MODES.first, &block) ⇒ Object
- #soft_contract(args = {}, &block) ⇒ Object
- #strict_contract(args = {}, &block) ⇒ Object
Instance Attribute Details
#contract_mode ⇒ Object
Returns the value of attribute contract_mode.
10 11 12 |
# File 'lib/dried_interaction/dsl.rb', line 10 def contract_mode @contract_mode end |
#contract_validator ⇒ Object
Returns the value of attribute contract_validator.
10 11 12 |
# File 'lib/dried_interaction/dsl.rb', line 10 def contract_validator @contract_validator end |
#for_method ⇒ Object
Returns the value of attribute for_method.
10 11 12 |
# File 'lib/dried_interaction/dsl.rb', line 10 def for_method @for_method end |
Instance Method Details
#contract(kind: :simple, mode: MODES.first, &block) ⇒ Object
12 13 14 15 |
# File 'lib/dried_interaction/dsl.rb', line 12 def contract(kind: :simple, mode: MODES.first, &block) @contract_mode = resolve_contract_mode(mode) @contract_validator = resolve_contract_validator(kind, &block) end |
#soft_contract(args = {}, &block) ⇒ Object
17 18 19 |
# File 'lib/dried_interaction/dsl.rb', line 17 def soft_contract(args = {}, &block) contract(args.merge(mode: :soft), &block) end |
#strict_contract(args = {}, &block) ⇒ Object
21 22 23 |
# File 'lib/dried_interaction/dsl.rb', line 21 def strict_contract(args = {}, &block) contract(args.merge(mode: :strict)) end |