Class: OpenWFE::ProcessDefinition::Context

Inherits:
Object
  • Object
show all
Defined in:
lib/openwfe/expressions/rprocdef.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContext

Returns a new instance of Context.



321
322
323
324
325
# File 'lib/openwfe/expressions/rprocdef.rb', line 321

def initialize
    @parent_expression = nil
    @top_expressions = []
    @previous_parent_expressions = []
end

Instance Attribute Details

#parent_expressionObject

Returns the value of attribute parent_expression.



318
319
320
# File 'lib/openwfe/expressions/rprocdef.rb', line 318

def parent_expression
  @parent_expression
end

#previous_parent_expressionsObject (readonly)

Returns the value of attribute previous_parent_expressions.



319
320
321
# File 'lib/openwfe/expressions/rprocdef.rb', line 319

def previous_parent_expressions
  @previous_parent_expressions
end

#top_expressionsObject

Returns the value of attribute top_expressions.



318
319
320
# File 'lib/openwfe/expressions/rprocdef.rb', line 318

def top_expressions
  @top_expressions
end

Instance Method Details

#discardObject



327
328
329
# File 'lib/openwfe/expressions/rprocdef.rb', line 327

def discard
    @discarded = true
end

#discarded?Boolean

Returns:

  • (Boolean)


330
331
332
# File 'lib/openwfe/expressions/rprocdef.rb', line 330

def discarded?
    (@discarded == true)
end

#pop_parent_expressionObject

Replaces the current parent expression with the one found on the top of the previous parent expression stack (pop).



351
352
353
354
# File 'lib/openwfe/expressions/rprocdef.rb', line 351

def pop_parent_expression

    @parent_expression = @previous_parent_expressions.pop
end

#push_parent_expression(exp) ⇒ Object

puts the current parent expression on top of the ‘previous parent expressions’ stack, the current parent expression is replaced with the supplied parent expression.



339
340
341
342
343
344
345
# File 'lib/openwfe/expressions/rprocdef.rb', line 339

def push_parent_expression (exp)

    @previous_parent_expressions.push(@parent_expression) \
        if @parent_expression

    @parent_expression = exp
end

#top_expressionObject

This method returns the top expression among the top expressions…



360
361
362
363
364
365
366
367
368
# File 'lib/openwfe/expressions/rprocdef.rb', line 360

def top_expression

    return nil if @top_expressions.size > 1

    exp = @top_expressions.first

    return exp if exp.first == "process-definition"
    nil
end