Module: SchemaValidations::ClassMethods

Defined in:
lib/schema_validations.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.extended(base) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/schema_validations.rb', line 7

def self.extended(base)
  base.send(:class_inheritable_array, :schema_validations_to_skip)
  base.send(:schema_validations_to_skip=, [])

  class << base
    alias_method_chain :allocate, :schema_validations
    alias_method_chain :new, :schema_validations
  end
end

Instance Method Details

#allocate_with_schema_validationsObject



21
22
23
24
# File 'lib/schema_validations.rb', line 21

def allocate_with_schema_validations
  load_schema_validations
  allocate_without_schema_validations
end

#new_with_schema_validations(*args) ⇒ Object



26
27
28
29
# File 'lib/schema_validations.rb', line 26

def new_with_schema_validations(*args)
  load_schema_validations
  new_without_schema_validations(*args) { |*block_args| yield(*block_args) if block_given? }
end

#skip_schema_validations(*syms) ⇒ Object



17
18
19
# File 'lib/schema_validations.rb', line 17

def skip_schema_validations(*syms)
  self.schema_validations_to_skip = syms
end