Class: Oddb2xml::Extractor

Inherits:
Object
  • Object
show all
Defined in:
lib/oddb2xml/extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ Extractor

Returns a new instance of Extractor.



28
29
30
# File 'lib/oddb2xml/extractor.rb', line 28

def initialize(xml)
  @xml = xml
end

Instance Attribute Details

#xmlObject

Returns the value of attribute xml.



27
28
29
# File 'lib/oddb2xml/extractor.rb', line 27

def xml
  @xml
end

Instance Method Details

#correct_code(pharmacode, length = 7) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/oddb2xml/extractor.rb', line 31

def correct_code(pharmacode, length=7)
  if pharmacode.length != length # restore zero at the beginnig
    ("%0#{length}i" % pharmacode.to_i)
  else
    pharmacode
  end
end