Class: GreenPepper::ExplicitStringType

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

Class Method Summary collapse

Methods inherited from TypeBase

can_parse?, inherited

Class Method Details

.convertObject



274
275
276
# File 'lib/greenpepper/converter.rb', line 274

def self.convert
  Proc.new{ |s| s[1..-2] }
end

.formatObject



278
279
280
281
282
283
284
285
286
# File 'lib/greenpepper/converter.rb', line 278

def self.format
  Proc.new{ |str,expected_format|
    if (expected_format.index("'") == 0)
      "'" + str.to_s + "'"
    else
      "\"" + str.to_s + "\""
    end
  }
end

.regexObject



270
271
272
# File 'lib/greenpepper/converter.rb', line 270

def self.regex
  /^\s*["'].*["']\s*$/
end