Class: GraphML::Key
- Inherits:
-
Object
- Object
- GraphML::Key
- Defined in:
- lib/ruby-graphml.rb
Instance Attribute Summary collapse
-
#default ⇒ Object
Returns the value of attribute default.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#for ⇒ Object
Returns the value of attribute for.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #append(key, val) ⇒ Object
-
#initialize(attrs) ⇒ Key
constructor
A new instance of Key.
Constructor Details
#initialize(attrs) ⇒ Key
Returns a new instance of Key.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ruby-graphml.rb', line 8 def initialize(attrs) attrs.each do |key, val| case key when 'id' @id = val when 'for' @for = val when 'attr.name' @name = val when 'attr.type' @type = val end end @desc = '' @default = '' end |
Instance Attribute Details
#default ⇒ Object
Returns the value of attribute default.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def default @default end |
#desc ⇒ Object
Returns the value of attribute desc.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def desc @desc end |
#for ⇒ Object
Returns the value of attribute for.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def for @for end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def name @name end |
#type ⇒ Object
Returns the value of attribute type.
7 8 9 |
# File 'lib/ruby-graphml.rb', line 7 def type @type end |
Instance Method Details
#append(key, val) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ruby-graphml.rb', line 25 def append(key, val) if key == 'desc' @desc += val elsif key == 'default' @default += val end end |