Class: Twb::Graph

Inherits:
Object
  • Object
show all
Defined in:
lib/twb/graph.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, id:, type:, properties: {}) ⇒ Graph

Returns a new instance of Graph.


27
28
29
30
31
32
# File 'lib/twb/graph.rb', line 27

def initialize (name:, id:, type:, properties: {})
  @name        = name
  @id          = id
  @type        = type
  @properties  = properties
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id


23
24
25
# File 'lib/twb/graph.rb', line 23

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name


23
24
25
# File 'lib/twb/graph.rb', line 23

def name
  @name
end

#propertiesObject

Returns the value of attribute properties


24
25
26
# File 'lib/twb/graph.rb', line 24

def properties
  @properties
end

#typeObject (readonly)

Returns the value of attribute type


23
24
25
# File 'lib/twb/graph.rb', line 23

def type
  @type
end

Instance Method Details

#dotLabelObject


34
35
36
37
# File 'lib/twb/graph.rb', line 34

def dotLabel
  # "JIRA 1::JIRA 1.csv" [label="JIRA 1.csv"]
  "\"%s\" [label=\"%s\"]" % [id, name] 
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)

39
40
41
# File 'lib/twb/graph.rb', line 39

def eql? other
  @name == other.name && @id == other.id && @type == other.type  && @properties == other.properties
end

#hashObject


43
44
45
# File 'lib/twb/graph.rb', line 43

def hash
  [@name, @id, @type, @properties].hash
end

#to_sObject


47
48
49
# File 'lib/twb/graph.rb', line 47

def to_s
  "name:'%s'  id:'%s'  t:'%s'  p:'%s'" % [@name, @id, @type, @properties.to_s]
end