Class: GreenPepper::NilType

Inherits:
TypeBase show all
Defined in:
lib/greenpepper/converter.rb

Class Method Summary collapse

Methods inherited from TypeBase

can_parse?, inherited

Class Method Details

.convertObject



200
201
202
203
204
# File 'lib/greenpepper/converter.rb', line 200

def self.convert
  Proc.new{ |s| 
    nil
  }
end

.formatObject



206
207
208
209
210
211
212
213
214
215
216
217
# File 'lib/greenpepper/converter.rb', line 206

def self.format
  Proc.new{ |n,expected_format|
    #The server return some weird unicode char when  a cell is 
    #empty and since ruby 1.8 doesn't like unicode in regex, we 
    #have to do this ugly path here.
    if /^\s*$/ === expected_format || expected_format[0] == 194
      n.to_s
    else
      expected_format
    end
  }
end

.regexObject



196
197
198
# File 'lib/greenpepper/converter.rb', line 196

def self.regex
  /^\s*(nil|null|none|nothing|\s*)\s*$/i
end