Class: Hbci::ElementUnparser

Inherits:
Object
  • Object
show all
Defined in:
lib/hbci/element_unparser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(element, type) ⇒ ElementUnparser

Returns a new instance of ElementUnparser.



8
9
10
11
# File 'lib/hbci/element_unparser.rb', line 8

def initialize(element, type)
  @element = element
  @type = type
end

Instance Attribute Details

#elementObject (readonly)

Returns the value of attribute element.



5
6
7
# File 'lib/hbci/element_unparser.rb', line 5

def element
  @element
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/hbci/element_unparser.rb', line 6

def type
  @type
end

Instance Method Details

#unparseObject



13
14
15
16
17
18
19
# File 'lib/hbci/element_unparser.rb', line 13

def unparse
  if type == :binary
    "@#{element.size}@#{element}"
  else
    element.to_s.gsub('?', '??').gsub('+', '?+').gsub(':', '?:').gsub('\'', '?\'')
  end
end