Class: Cheri::Builder::TypeConnecter::SCtr

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

Overview

TCtr

Instance Method Summary collapse

Constructor Details

#initialize(sym, adder = nil, &k) ⇒ SCtr

:nodoc: all



358
359
360
361
362
363
364
# File 'lib/cheri/builder/connecter.rb', line 358

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

Instance Method Details

#<=>(other) ⇒ Object



378
379
380
# File 'lib/cheri/builder/connecter.rb', line 378

def <=>(other)
  @m.to_s <=> other.sym.to_s      
end

#==(other) ⇒ Object



370
371
372
# File 'lib/cheri/builder/connecter.rb', line 370

def ==(other)
  SCtr === other ? @m == other.sym : @m == other      
end

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



386
387
388
389
390
391
392
393
# File 'lib/cheri/builder/connecter.rb', line 386

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)


374
375
376
# File 'lib/cheri/builder/connecter.rb', line 374

def eql?(other)
  SCtr === other ? @m.eql?(other.sym) : @m.eql?(other)
end

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



382
383
384
# File 'lib/cheri/builder/connecter.rb', line 382

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

#symObject



366
367
368
# File 'lib/cheri/builder/connecter.rb', line 366

def sym
  @m
end