Class: DTest::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/dtest/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, option, &block) ⇒ Block

Returns a new instance of Block.



240
241
242
243
244
245
246
247
# File 'lib/dtest/core.rb', line 240

def initialize(name, option, &block)
  @name = name
  @parent = nil
  @option = option
  @block = block
  @result = nil # caller result object
  @parameter = nil
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



237
238
239
# File 'lib/dtest/core.rb', line 237

def name
  @name
end

#parameterObject

Returns the value of attribute parameter.



238
239
240
# File 'lib/dtest/core.rb', line 238

def parameter
  @parameter
end

#parentObject

Returns the value of attribute parent.



238
239
240
# File 'lib/dtest/core.rb', line 238

def parent
  @parent
end

#resultObject

Returns the value of attribute result.



238
239
240
# File 'lib/dtest/core.rb', line 238

def result
  @result
end

Instance Method Details

#call(context, name = nil) ⇒ Object



249
250
251
252
253
254
255
256
257
258
# File 'lib/dtest/core.rb', line 249

def call(context, name = nil)
  @parent = name if name
  context.call({
    :parent => @parent,
    :name => @name,
    :option => @option,
    :result => @result,
    :parameter => @parameter,
  }, @block)
end