Class: Rufus::Decision::Table::Header

Inherits:
Object
  • Object
show all
Defined in:
lib/rufus/decision/table.rb

Instance Attribute Summary

Instance Method Summary

Constructor Details

- (Header) initialize

A new instance of Header



561
562
563
564
565
# File 'lib/rufus/decision/table.rb', line 561

def initialize

  @ins = {}
  @outs = {}
end

Instance Attribute Details

- (Object) ins

Returns the value of attribute ins



559
560
561
# File 'lib/rufus/decision/table.rb', line 559

def ins
  @ins
end

- (Object) outs

Returns the value of attribute outs



559
560
561
# File 'lib/rufus/decision/table.rb', line 559

def outs
  @outs
end

Instance Method Details

- (Object) add(cell, x)



567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/rufus/decision/table.rb', line 567

def add (cell, x)

  if cell.match(IN)

    @ins[x] = cell[3..-1]

  elsif cell.match(OUT)

    @outs[x] = cell[4..-1]

  end
  # else don't add
end

- (Object) to_csv



581
582
583
584
585
# File 'lib/rufus/decision/table.rb', line 581

def to_csv

  (@ins.keys.sort.collect { |k| "in:#{@ins[k]}" } +
   @outs.keys.sort.collect { |k| "out:#{@outs[k]}" }).join(',')
end