Class: Cheri::Builder::TypeConnecter::TCtr

Inherits:
Object
  • Object
show all
Defined in:
lib/cheri/builder/connecter.rb

Overview

Sym

Instance Method Summary collapse

Constructor Details

#initialize(mod, adder = nil, &k) ⇒ TCtr

:nodoc: all



319
320
321
322
323
324
325
# File 'lib/cheri/builder/connecter.rb', line 319

def initialize(mod,adder=nil,&k)
  raise Cheri.type_error(mod,Class,Module) unless Module === mod
  raise Cheri.type_error(adder,Symbol) if adder && !(Symbol === adder)
  @m = mod
  @a = adder if adder
  @k = k if k
end

Instance Method Details

#<=>(other) ⇒ Object



339
340
341
# File 'lib/cheri/builder/connecter.rb', line 339

def <=>(other)
  @m.name <=> other.mod.name      
end

#==(other) ⇒ Object



331
332
333
# File 'lib/cheri/builder/connecter.rb', line 331

def ==(other)
  TCtr === other ? @m == other.mod : @m == other      
end

#connect(parent, obj, sym, props) ⇒ Object



347
348
349
350
351
352
353
354
# File 'lib/cheri/builder/connecter.rb', line 347

def connect(parent,obj,sym,props)
  if @k
    @k.call(parent,obj,sym,props)
  else
    parent.__send__(sym,obj) #rescue nil
  end
  nil
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


335
336
337
# File 'lib/cheri/builder/connecter.rb', line 335

def eql?(other)
  TCtr === other ? @m.eql?(other.mod) : @m.eql?(other)
end

#modObject



327
328
329
# File 'lib/cheri/builder/connecter.rb', line 327

def mod
  @m
end

#prepare(ctx, builder, obj, sym, props) ⇒ Object



343
344
345
# File 'lib/cheri/builder/connecter.rb', line 343

def prepare(ctx,builder,obj,sym,props)
  ctx.ppd(self,builder,obj,(@a || sym),props)
end