Class: Alchemrest::Transforms::Constrainable

Inherits:
Anima
  • Object
show all
Defined in:
lib/alchemrest/transforms/constrainable.rb

Overview

Calling Constrainable.with_additional_attributes(…) will return a module that can be included in a ‘Morpher::Transform` class to allow adding validation constraints using the `#where` method. We do this in both `ToType` and `FromType`

Defined Under Namespace

Modules: InstanceMethods

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Constrainable

Returns a new instance of Constrainable.



9
10
11
12
# File 'lib/alchemrest/transforms/constrainable.rb', line 9

def initialize(args = {})
  additional_attributes = args[:additional_attributes]
  super(*additional_attributes, :constraints)
end

Instance Method Details

#included(base) ⇒ Object



14
15
16
17
# File 'lib/alchemrest/transforms/constrainable.rb', line 14

def included(base)
  base.include(InstanceMethods)
  super
end