Sha256: b8ef4fd6120a41b7d6d35df5ab4d15c657b5ab42c41417721d87280e0609ab45
Contents?: true
Size: 1.43 KB
Versions: 4
Compression:
Stored size: 1.43 KB
Contents
using Ahnnotate::Refinement::YieldSelf module Ahnnotate module Facet module Models class Main def initialize(config, tables, vfs) @config = config @tables = tables @vfs = vfs end def call formatter = Function::Format.new(comment: "#") model_nodes.each do |model_node| table = @tables[model_node.table_name] if table.nil? next end @vfs[model_node.path] = formatter.call(table, @vfs[model_node.path]) end end def model_nodes @model_nodes ||= begin model_path = @config["annotate", "models", "path"] model_extension = @config["annotate", "models", "extension"] model_files = @vfs.each_in(model_path, model_extension) processor = Processor.new models = model_files.map do |path, contents| module_nodes = processor.call(contents) module_nodes.each { |node| node.path = path } module_nodes end models .flatten .yield_self(&ResolveClassRelationships.new) .yield_self(&ResolveActiveRecordModels.new) .select(&:is_a_kind_of_activerecord_base?) .reject(&:abstract_class?) end end end end end end
Version data entries
4 entries across 4 versions & 1 rubygems