Class: Cheri::Builder::Generator::TypeFactory
- Inherits:
-
Object
- Object
- Cheri::Builder::Generator::TypeFactory
- Defined in:
- lib/cheri/builder/generator.rb
Instance Method Summary collapse
- #builder(ctx, sym, *r, &k) ⇒ Object
-
#initialize(mod, types) ⇒ TypeFactory
constructor
A new instance of TypeFactory.
Constructor Details
#initialize(mod, types) ⇒ TypeFactory
Returns a new instance of TypeFactory.
103 104 105 106 107 108 |
# File 'lib/cheri/builder/generator.rb', line 103 def initialize(mod,types) raise Cheri.type_error(types,BuildTypes) unless BuildTypes === types @mod = mod @types = types @inv = types.invert end |
Instance Method Details
#builder(ctx, sym, *r, &k) ⇒ Object
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/cheri/builder/generator.rb', line 109 def builder(ctx,sym,*r,&k) if (type = @types[sym]) TypeBuilder.new(@mod,type,ctx,sym,*r,&k) elsif @inv[r.first.class] if sym == :cherify CherifyBuilder.new(@mod,ctx,sym,*r,&k) elsif sym == :cheri_yield CheriYieldBuilder.new(@mod,ctx,sym,*r,&k) else nil end else nil end end |