Module: Trailblazer::Operation::Contract::Build
- Defined in:
- lib/trailblazer/operation/contract.rb
Class Method Summary collapse
-
.for(operation, options, name: "default", constant: nil, builder: nil) ⇒ Object
bla build contract at runtime.
Class Method Details
.for(operation, options, name: "default", constant: nil, builder: nil) ⇒ Object
bla build contract at runtime.
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/trailblazer/operation/contract.rb', line 19 def self.for(operation, , name:"default", constant:nil, builder: nil) # TODO: we could probably clean this up a bit at some point. contract_class = constant || ["contract.#{name}.class"] model = ["model"] # FIXME: model.default name = "contract.#{name}" return [name] = Option::KW.(builder).(operation, , constant: contract_class, name: name) if builder [name] = contract_class.new(model) end |