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.
218 219 220 221 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 |
# File 'lib/oflow/graffle.rb', line 218 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.
216 217 218 |
# File 'lib/oflow/graffle.rb', line 216 def bounds @bounds end |
#color ⇒ Object
Returns the value of attribute color.
214 215 216 |
# File 'lib/oflow/graffle.rb', line 214 def color @color end |
#line_id ⇒ Object
Returns the value of attribute line_id.
211 212 213 |
# File 'lib/oflow/graffle.rb', line 211 def line_id @line_id end |
#name ⇒ Object
Returns the value of attribute name.
212 213 214 |
# File 'lib/oflow/graffle.rb', line 212 def name @name end |
#options ⇒ Object
Returns the value of attribute options.
213 214 215 |
# File 'lib/oflow/graffle.rb', line 213 def @options end |
#shape ⇒ Object
Returns the value of attribute shape.
215 216 217 |
# File 'lib/oflow/graffle.rb', line 215 def shape @shape end |
Instance Method Details
#first_option ⇒ Object
258 259 260 261 262 263 264 265 266 267 |
# File 'lib/oflow/graffle.rb', line 258 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
269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 |
# File 'lib/oflow/graffle.rb', line 269 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
286 287 288 |
# File 'lib/oflow/graffle.rb', line 286 def to_s() "TaskInfo{id:#{@id}, line_id:#{line_id}, name: #{name}, options: #{}, bounds: #{@bounds}, shape: #{@shape}, color: #{@color}}" end |