Sha256: e8dc888c71e600fd55fba46837b934bc7fa2ce15ac65649f8158408740b735c6
Contents?: true
Size: 551 Bytes
Versions: 36
Compression:
Stored size: 551 Bytes
Contents
module Schemacop::V2 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
36 entries across 36 versions & 1 rubygems