Sha256: 8dbeae8208c80dcaaaa3de15b7b64500256b060bda00447ede2ff66f61469c16

Contents?: true

Size: 1.69 KB

Versions: 2

Compression:

Stored size: 1.69 KB

Contents

# Overrides standard ruby method_missing interceptor.
# NOTE:
#   This is a workaround for standard method_missing
#   generates very high CPU usage
#   when a significant model is loaded in memory.


def method_missing(methId,args=nil)
  msg=respond_to?(:rdf_uri) ? "#{rdf_uri}" : "nil"
  log.error { "method #{methId} not available for object of class #{self.class.name}, (uri=#{msg})(to_s=#{self})" }

  if msg=="ukb_null"
    log.error { <<END
********** INVALID MODEL DETECTED **********
********** INVALID MODEL DETECTED **********
**** An invalid source model was used (an ukb_null was found).
**** Probable cause is that you are using a RSM modeler, and
**** one of your model contains an invalid reference somewhere.
****
**** Because RSM does not tell you where this error is located,
**** you have to use your .nt export file :
****
**** 1) open .nt export file with a text editor.
**** 2) locate <http://kb#null> string.
**** 3) locate left member refering to this null element.
**** 4) This element is the key of RSM invalid element.
**** 5) Locate this element in RSM and fix it (or delete it).
**** 6) Re-export your model and check for null uris.
****
********** INVALID MODEL DETECTED **********
END
    }
  end

  log.debug {
    msg=""
    self.methods.sort{|a,b| a<=>b}.each {|m|
      msg="#{msg}, #{m}"
    }
    "Available methods are: #{msg}"
  }

  #self.included_modules.each { |m|
  #	#puts "include #{m}"
  #	}
  puts "end of custom method_missing"
  #TODO: l'appel au stock method_missing genere des temps de traitements infinis. (cpu a 100%, conso memoire enorme)
  #super
  puts "exiting"
  throw NoMethodError.new("method missing '#{methId}' for object '#{self.class.name}'",methId,args)
  #exit
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ontomde-core-1.0.4 lib/ontomde-core/custom_method_missing.rb
ontomde-core-1.0.6 lib/ontomde-core/custom_method_missing.rb