Class: Axn::Mountable::Helpers::Validator

Inherits:
Object
  • Object
show all
Defined in:
lib/axn/mountable/helpers/validator.rb

Overview

Handles validation logic for Descriptor

Instance Method Summary collapse

Constructor Details

#initialize(descriptor) ⇒ Validator

Returns a new instance of Validator.



8
9
10
# File 'lib/axn/mountable/helpers/validator.rb', line 8

def initialize(descriptor)
  @descriptor = descriptor
end

Instance Method Details

#validate!Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/axn/mountable/helpers/validator.rb', line 12

def validate!
  validate_name!
  validate_axn_class_or_block!
  validate_method_name!(@descriptor.name.to_s)
  validate_superclass_and_inherit_conflict!

  if @descriptor.existing_axn_klass
    validate_existing_axn_class!
  elsif @descriptor.block.present?
    validate_callable!(@descriptor.block)
  end
end