module BloodContracts::Core::Extractable::ClassMethods
DSL definition
Attributes
extractors[R]
Configuration about how to extract data from the value, just list of context keys and methods
policy[RW]
Tram::Policy ancestor that will be used for validation
@param [Class]
Public Instance Methods
extract(extractor_name, method_name: extractor_name)
click to toggle source
DSL to define which method to use to extract data from the value
@param extractor_name [Symbol] key to store the extracted data in the
context
@option method_name [Symbol] custom method name to use for extraction @return [Nothing]
# File lib/blood_contracts/core/extractable.rb, line 35 def extract(extractor_name, method_name: extractor_name) extractors[extractor_name] = [method_name] end
inherited(child)
click to toggle source
@private
Calls superclass method
# File lib/blood_contracts/core/extractable.rb, line 23 def inherited(child) super child.instance_variable_set(:@extractors, extractors.dup || {}) end