module Such::Part
Constants
- PLUG_PATTERN
Public Class Methods
new(*parameters, &block)
click to toggle source
Calls superclass method
# File lib/such/part.rb, line 5 def initialize(*parameters, &block) super(*parameters) self.class.plugs.each do |plg| if md = PLUG_PATTERN.match(plg) plg, sym, cls = "#{plg}=".to_sym, "#{md[:sym]}!".to_sym, Object.const_get("Such::#{md[:cls]}") # self.<plg> = Such::<cls>.new(self, :<sym>!, &block) public_send plg, cls.new(self, sym, &block) end end end
Public Instance Methods
message(*parameters)
click to toggle source
# File lib/such/part.rb, line 16 def message(*parameters) self.class.plugs.each{|plg| public_send(plg).message(*parameters) } end
method_missing(maybe,*args)
click to toggle source
Calls superclass method
# File lib/such/part.rb, line 20 def method_missing(maybe,*args) # maybe a plug down the plugged things. super unless args.length==0 and PLUG_PATTERN.match?(maybe) self.class.plugs.each do |plug| thing = public_send(plug) if thing.is_a? Such::Part if obj = thing.public_send(maybe) return obj end end end return nil end