Class: GraphML::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-graphml.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#defaultObject

Returns the value of attribute default.



7
8
9
# File 'lib/ruby-graphml.rb', line 7

def default
  @default
end

#descObject

Returns the value of attribute desc.



7
8
9
# File 'lib/ruby-graphml.rb', line 7

def desc
  @desc
end

#forObject

Returns the value of attribute for.



7
8
9
# File 'lib/ruby-graphml.rb', line 7

def for
  @for
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/ruby-graphml.rb', line 7

def id
  @id
end

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/ruby-graphml.rb', line 7

def name
  @name
end

#typeObject

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