Class: YARD::Handlers::Ruby::ActiveRecord::Fields::CreateTableHandler

Inherits:
MethodHandler
  • Object
show all
Defined in:
lib/yard-activerecord/fields/create_table_handler.rb

Instance Method Summary collapse

Instance Method Details

#processObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/yard-activerecord/fields/create_table_handler.rb', line 6

def process
  return unless globals.ar_schema
  table_name = call_params.first
  class_name_regex = table_name.
    singularize.
    split('_').
    map(&:camelize).
    join('(::|_)?')
  regex = Regexp.new("#{class_name_regex}$")
  globals.klass = YARD::Registry.all(:class).find do |co|
    regex.match(co.path)
  end
  parse_block(statement.last.last)
  globals.klass = nil
end