Sha256: 69de6b464fd3ff528100a238c215ec189ffac23a5845f33d88345bb0107868c2
Contents?: true
Size: 547 Bytes
Versions: 7
Compression:
Stored size: 547 Bytes
Contents
module Schemacop class NodeResolver class_attribute :node_classes self.node_classes = [].freeze def self.register(node_class, before: nil) if before unless (index = node_classes.find_index(before)) fail "Cannot insert before class #{before} which has not been registered yet." end node_classes.insert(index, node_class) else self.node_classes += [node_class] end end def self.resolve(type) node_classes.find { |c| c.type_matches?(type) } end end end
Version data entries
7 entries across 7 versions & 1 rubygems