Module: Wool::SexpAnalysis::ProtocolRegistry

Extended by:
ModuleExtensions
Defined in:
lib/wool/analysis/protocol_registry.rb

Overview

The ProtocolRegistry module handles negotiating instantiated protocols at compile-time, such as the automatically-generated protocols created by a class creation (as each class has a corresponding protocol, though some distinct classes may have equivalent protocols).

Class Method Summary collapse

Methods included from ModuleExtensions

attr_accessor_with_default, cattr_accessor, cattr_accessor_with_default, cattr_get_and_setter, cattr_reader, cattr_writer

Class Method Details

.[](class_name) ⇒ Object



21
22
23
# File 'lib/wool/analysis/protocol_registry.rb', line 21

def self.[](class_name)
  return query(:class_path => class_name.gsub(/^::/, ''))
end

.add_class_protocol(class_protocol) ⇒ Object



16
17
18
19
# File 'lib/wool/analysis/protocol_registry.rb', line 16

def self.add_class_protocol(class_protocol)
  add_protocol class_protocol
  self.class_protocols[class_protocol.class_used.path] = class_protocol
end

.add_protocol(proto) ⇒ Object



12
13
14
# File 'lib/wool/analysis/protocol_registry.rb', line 12

def self.add_protocol(proto)
  self.protocols << proto
end

.query(query = {}) ⇒ Object



25
26
27
28
29
# File 'lib/wool/analysis/protocol_registry.rb', line 25

def self.query(query={})
  if query[:class_path]
    return [self.class_protocols[query[:class_path]]]
  end
end