Class: Cheri::Builder::Generator::EvalBuilder
- Inherits:
-
Object
- Object
- Cheri::Builder::Generator::EvalBuilder
- Defined in:
- lib/cheri/builder/generator.rb
Instance Method Summary collapse
- #__ext ⇒ Object
- #__mapped ⇒ Object
- #__pkg ⇒ Object
- #__tc ⇒ Object
- #__unmapped ⇒ Object
- #build(type, sym = nil, &k) ⇒ Object
- #build_package(str) ⇒ Object
- #extend_builder(bld) ⇒ Object
-
#initialize(*r, &k) ⇒ EvalBuilder
constructor
A new instance of EvalBuilder.
- #type(mod, &k) ⇒ Object (also: #types, #symbol, #symbols)
Constructor Details
#initialize(*r, &k) ⇒ EvalBuilder
Returns a new instance of EvalBuilder.
346 347 348 349 350 |
# File 'lib/cheri/builder/generator.rb', line 346 def initialize(*r,&k) @__mapped = BuildTypes.new @__unmapped = [] instance_eval(&k) end |
Instance Method Details
#__ext ⇒ Object
360 361 362 |
# File 'lib/cheri/builder/generator.rb', line 360 def __ext @__ext end |
#__mapped ⇒ Object
352 353 354 |
# File 'lib/cheri/builder/generator.rb', line 352 def __mapped @__mapped end |
#__pkg ⇒ Object
364 365 366 |
# File 'lib/cheri/builder/generator.rb', line 364 def __pkg @__pkg end |
#__tc ⇒ Object
368 369 370 |
# File 'lib/cheri/builder/generator.rb', line 368 def __tc @__tc end |
#__unmapped ⇒ Object
356 357 358 |
# File 'lib/cheri/builder/generator.rb', line 356 def __unmapped @__unmapped end |
#build(type, sym = nil, &k) ⇒ Object
382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 |
# File 'lib/cheri/builder/generator.rb', line 382 def build(type,sym=nil,&k) raise Cheri.type_error(type,Class) unless Class === type if sym if Symbol === sym add_mapped(type,sym,&k) elsif Array === sym sym.each do |s| raise Cheri.type_error(s,Symbol) unless Symbol === s add_mapped(type,s,&k) end else raise Cheri.type_error(sym,Symbol,Array) end else @__unmapped << BuildType.new(type,nil,&k) unless @__unmapped.include?(type) end end |
#build_package(str) ⇒ Object
406 407 408 409 410 411 412 413 414 415 |
# File 'lib/cheri/builder/generator.rb', line 406 def build_package(str) raise Cheri.type_error(str,String) unless String === str raise BuilderException,"packages supported only for Java (JRuby)" unless defined?JRUBY_VERSION require 'cheri/java/builder' if @__pkg @__pkg << str unless @__pkg.include?(str) else @__pkg = [str] end end |
#extend_builder(bld) ⇒ Object
372 373 374 375 376 377 378 379 380 |
# File 'lib/cheri/builder/generator.rb', line 372 def extend_builder(bld) return unless bld raise BuilderException,"only one extend_builder may be specified" if @__ext unless bld.respond_to?(:factory) || bld.respond_to?(:connecter) || bld.respond_to?(:consumer) || bld.respond_to?(:resolver) raise ArgumentError,"not a valid builder: #{bld}" end @__ext = bld end |
#type(mod, &k) ⇒ Object Also known as: types, symbol, symbols
417 418 419 420 |
# File 'lib/cheri/builder/generator.rb', line 417 def type(mod,&k) @__tc ||= TypeConnecter.new @__tc.type(mod,&k) end |