Class: YmlBuilder::Common

Inherits:
Object
  • Object
show all
Defined in:
lib/yml_builder/common.rb

Class Method Summary collapse

Class Method Details

.convert_key(key) ⇒ Object



13
14
15
16
17
# File 'lib/yml_builder/common.rb', line 13

def self.convert_key(key)
  return 'currencyId' if key == :currency_id
  return 'categoryId' if key == :category_id
  key.to_s
end

.encode_special_chars(out) ⇒ Object



4
5
6
7
8
9
10
# File 'lib/yml_builder/common.rb', line 4

def self.encode_special_chars(out)
  return out.to_s.gsub(/[\"\&\>\<\']/, '"' => '&quot;',
                       '&'                 => '&amp;',
                       '>'                 => '&gt;',
                       '<'                 => '&lt;',
                       "'"                 => '&apos;')
end