Class: CPEE::Transformation::Loop

Inherits:
Object
  • Object
show all
Includes:
Container, Struct, Enumerable
Defined in:
lib/cpee/transformation/structures.rb

Overview

}}}

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Struct

#each, #length

Methods included from Container

#container?

Constructor Details

#initialize(id) ⇒ Loop

Returns a new instance of Loop.



125
126
127
128
129
130
131
132
133
134
# File 'lib/cpee/transformation/structures.rb', line 125

def initialize(id)
  @container = true
  @id = id
  @type = :loop
  @mode = :pre_test
  @condition = []
  @sub = []
  @condition_type = nil
  @attributes = {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



123
124
125
# File 'lib/cpee/transformation/structures.rb', line 123

def attributes
  @attributes
end

#conditionObject

Returns the value of attribute condition.



122
123
124
# File 'lib/cpee/transformation/structures.rb', line 122

def condition
  @condition
end

#condition_typeObject

Returns the value of attribute condition_type.



122
123
124
# File 'lib/cpee/transformation/structures.rb', line 122

def condition_type
  @condition_type
end

#idObject (readonly)

Returns the value of attribute id.



121
122
123
# File 'lib/cpee/transformation/structures.rb', line 121

def id
  @id
end

#modeObject

Returns the value of attribute mode.



122
123
124
# File 'lib/cpee/transformation/structures.rb', line 122

def mode
  @mode
end

#subObject (readonly)

Returns the value of attribute sub.



121
122
123
# File 'lib/cpee/transformation/structures.rb', line 121

def sub
  @sub
end

#typeObject

Returns the value of attribute type.



122
123
124
# File 'lib/cpee/transformation/structures.rb', line 122

def type
  @type
end

Instance Method Details

#condition?Boolean

Returns:

  • (Boolean)


124
# File 'lib/cpee/transformation/structures.rb', line 124

def condition?; true; end

#new_branchObject



135
136
137
# File 'lib/cpee/transformation/structures.rb', line 135

def new_branch
  (@sub << Alternative.new(@id)).last
end