Module: Cheri::Builder::Builder

Includes:
Frame
Included in:
AbstractBuilder, Generator::TypeBuilder
Defined in:
lib/cheri/builder/base.rb

Overview

Builder extends the functionality of Frame, extracting the symbol (sym) and arguments (args) from the arguments passed by a factory. Like Frame, it is a convenience that may be included in (or otherwise used to extend) builder classes/objects.

Instance Method Summary collapse

Methods included from Frame

#any?, #block, #ctx, #inspect, #mod, #object

Instance Method Details

#argsObject

Returns the arguments (excluding ctx and sym) passed by the factory that created this builder.



135
136
137
# File 'lib/cheri/builder/base.rb', line 135

def args
  @args  
end

#child?Boolean

Overrides Frame#child? to return true.

Returns:

  • (Boolean)


150
151
152
# File 'lib/cheri/builder/base.rb', line 150

def child?
  true
end

#initialize(ctx, sym, *args, &blk) ⇒ Object

Calls super to store context and block, then stores sym and args in @sym and @args.



121
122
123
124
125
# File 'lib/cheri/builder/base.rb', line 121

def initialize(ctx,sym,*args,&blk) #:doc:
  super(ctx,&blk)
  @sym = sym
  @args = args
end

#parent?Boolean

Overrides Frame#parent? to return true.

Returns:

  • (Boolean)


145
146
147
# File 'lib/cheri/builder/base.rb', line 145

def parent?
  true  
end

#runObject



139
140
141
142
# File 'lib/cheri/builder/base.rb', line 139

def run
  @ctx.call(self,&@blk) if @blk
  @obj
end

#symObject

Returns the symbol passed by the factory that created this builder. The symbol normally originates in the method_missing method of the client object.



129
130
131
# File 'lib/cheri/builder/base.rb', line 129

def sym
  @sym
end