lib/onoma/migration.rb
# Parse en XML migration to a Onoma::Migration object
Parse en XML migration to a Onoma::Migration object
Parse en XML migration to a Onoma :: Migration object
def parse(file)
        f = File.open(file, 'rb')
        document = Nokogiri::XML(f) do |config|
          config.strict.nonet.noblanks.noent
        end
        f.close
        root = document.root
        number = file.basename.to_s.split('_').first.to_i
        new(number, root['name']) do |m|
          root.children.each do |child|
            next unless child.is_a? Nokogiri::XML::Element
            m.add "Onoma::Migration::Actions::#{child.name.underscore.classify}".constantize.new(child)
          end
        end
      end
def parse ( file ) f = File . open ( file , 'rb' ) document = Nokogiri :: XML ( f ) do | config | config . strict . nonet . noblanks . noent end f . close root = document . root number = file . basename . to_s . split ( '_' ) . first . to_i new ( number , root [ 'name' ] ) do | m | root . children . each do | child | next unless child . is_a? Nokogiri :: XML :: Element m . add "Onoma::Migration::Actions::#{child.name.underscore.classify}" . constantize . new ( child ) end end end
Parse en XML migration to a Onoma::Migration object
Parse en XML migration to a Onoma :: Migration object
# puts "Parse #{file}"
file
<not_specific>