Class: OFlow::Graffle::TaskInfo
Overview
LineInfo
Instance Attribute Summary collapse
-
#bounds ⇒ Object
Returns the value of attribute bounds.
-
#color ⇒ Object
Returns the value of attribute color.
-
#line_id ⇒ Object
Returns the value of attribute line_id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#options ⇒ Object
Returns the value of attribute options.
-
#shape ⇒ Object
Returns the value of attribute shape.
Attributes inherited from Element
Instance Method Summary collapse
- #first_option ⇒ Object
- #get_class ⇒ Object
-
#initialize(nodes) ⇒ TaskInfo
constructor
A new instance of TaskInfo.
- #to_s ⇒ Object
Constructor Details
#initialize(nodes) ⇒ TaskInfo
Returns a new instance of TaskInfo.
222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
# File 'lib/oflow/graffle.rb', line 222 def initialize(nodes) super if (ln = Graffle.get_key_value(nodes, 'Line')).nil? @line_id = nil else @line_id = Graffle.get_key_value(ln, 'ID') end @shape = Graffle.get_key_value(nodes, 'Shape') color_node = Graffle.get_key_value(Graffle.get_key_value(Graffle.get_key_value(nodes, 'Style'), 'fill'), 'Color') if color_node.nil? @color = nil else @color = [Graffle.get_key_value(color_node, 'r').to_f, Graffle.get_key_value(color_node, 'g').to_f, Graffle.get_key_value(color_node, 'b').to_f] end unless (@bounds = Graffle.get_key_value(nodes, 'Bounds')).nil? @bounds = @bounds.delete('{}').split(',') @bounds.map! { |s| s.to_i } end @options = { } text = Graffle.get_text(Graffle.get_key_value(nodes, 'Text')) unless text.nil? text.split("\n").each do |line| pair = line.split(':', 2) if 1 == pair.length @name = pair[0] else k = pair[0] if 0 == k.length k = nil else k = k.to_sym end @options[k] = pair[1] end end end end |
Instance Attribute Details
#bounds ⇒ Object
Returns the value of attribute bounds.
220 221 222 |
# File 'lib/oflow/graffle.rb', line 220 def bounds @bounds end |
#color ⇒ Object
Returns the value of attribute color.
218 219 220 |
# File 'lib/oflow/graffle.rb', line 218 def color @color end |
#line_id ⇒ Object
Returns the value of attribute line_id.
215 216 217 |
# File 'lib/oflow/graffle.rb', line 215 def line_id @line_id end |
#name ⇒ Object
Returns the value of attribute name.
216 217 218 |
# File 'lib/oflow/graffle.rb', line 216 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
217 218 219 |
# File 'lib/oflow/graffle.rb', line 217 def @options end |
#shape ⇒ Object
Returns the value of attribute shape.
219 220 221 |
# File 'lib/oflow/graffle.rb', line 219 def shape @shape end |
Instance Method Details
#first_option ⇒ Object
262 263 264 265 266 267 268 269 270 271 |
# File 'lib/oflow/graffle.rb', line 262 def first_option() target = nil op = nil if name.nil? .each { |k,v| target, op = k, v; break } else target = name end [target, op] end |
#get_class ⇒ Object
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/oflow/graffle.rb', line 273 def get_class() return nil if .nil? return nil if (s = [:class]).nil? s.strip! c = nil begin # TBD search all modules and classes for a match that is also an Actor # Assume the environment is safe since it is being used to create # processes from user provided code anyway. c = Object.class_eval(s) rescue Exception c = ::OFlow::Actors.module_eval(s) end c end |
#to_s ⇒ Object
290 291 292 |
# File 'lib/oflow/graffle.rb', line 290 def to_s() "TaskInfo{id:#{@id}, line_id:#{line_id}, name: #{name}, options: #{}, bounds: #{@bounds}, shape: #{@shape}, color: #{@color}}" end |