How to use mt940 gem file

365 Views Asked by At

Hi I have installed mt940 gem file and trying to access its methods as follows

require 'mt940'
#require 'mt940_parser'


class HomePageController < ApplicationController

  def aboutus
    #read all the files
     Dir.foreach(directory_path) do |item|
      puts item + "\n"
      MT940::Base.transactions(item)

      end

     end


 end

but um getting an error

NameError in HomePageController#aboutus
uninitialized constant MT940::Base

Um quite new to ruby on rails and I do not have a clue about it. If any one can help thank you

2

There are 2 best solutions below

0
On BEST ANSWER

I also included MT940 parser gem along with MT940. Because of that I got a different implementation and once I removed MT940 parser it worked.

0
On

Which gem are you using? some of the MT940 gems have a bit of a wired namespace and needs to required differently.

shameless promotion :) you might want to look into Cmxl - your friendly MT940 parser: https://github.com/railslove/cmxl