Module: BioTable::Formatter

Defined in:
lib/bio-table/formatter.rb

Class Method Summary collapse

Class Method Details

.strip_quotes(list) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/bio-table/formatter.rb', line 20

def Formatter::strip_quotes list
  list.map { |field| 
    if field == nil
      nil
    else
      first = field[0,1]
      if first == "\"" or first == "'"
        last = field[-1,1]
        if first == last
          field = field[1..-2]
        end
      end
      field 
    end
  }
end

.transform_header_ids(modify, list) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/bio-table/formatter.rb', line 4

def Formatter::transform_header_ids modify, list
  l = list.dup
  case modify
    when :downcase then l.map { |h| h.downcase }
    when :upcase   then l.map { |h| h.upcase }
    else                l
  end
end

.transform_row_ids(modify, list) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/bio-table/formatter.rb', line 12

def Formatter::transform_row_ids modify, list
  l = list.dup
  case modify
    when :downcase then l[0].downcase!
    when :upcase   then l[0].upcase!
  end
  l
end