Module: YARD::Handlers::Ruby::ActiveRecord::Validate

Defined in:
lib/yard-activerecord/validations/validates_handler.rb

Defined Under Namespace

Classes: ValidatesHandler

Constant Summary collapse

[
  :acceptance,
  :validates_associated,
  :confirmation,
  :exclusion,
  :format,
  :inclusion,
  :length,
  :numericality,
  :presence,
  :absence,
  :uniqueness,
  :validates_with,
  :validates_each
]

Class Method Summary collapse

Class Method Details

.add_validation_type(type, link) ⇒ Object



22
23
24
25
# File 'lib/yard-activerecord/validations/validates_handler.rb', line 22

def self.add_validation_type( type, link )
  @custom_types ||= {}
  @custom_types[type.to_sym] = link
end


27
28
29
30
31
32
33
34
35
36
# File 'lib/yard-activerecord/validations/validates_handler.rb', line 27

def self.link_for_validation( type )
  type = type.downcase.to_sym
  if STANDARD_LINKS.include?( type )
    "http://edgeguides.rubyonrails.org/active_record_validations.html##{type}"
  elsif @custom_types && link = @custom_types[ type ]
    link
  else
    nil
  end
end