lib/nydp/builtin.rb in nydp-0.0.10.1 vs lib/nydp/builtin.rb in nydp-0.0.11

- old
+ new

@@ -3,17 +3,26 @@ module Nydp::Builtin module Base def invoke vm, args builtin_invoke vm, args + rescue Nydp::Error => ne + raise ne rescue Exception => e - new_msg = "Invoking #{self.class.name}\nwith args #{args}\nraised\n#{Nydp.indent_text e.message}" + new_msg = "Called #{self.inspect}\nwith args #{args.inspect}\nraised\n#{Nydp.indent_text e.message}" raise $!, new_msg, $!.backtrace end - end - def inspect ; self.class.name ; end - def to_s ; self.class.name ; end + def name + cname = self.class.name.split("::").last + cname = cname.gsub(/([a-z])([A-Z])/) { |m| "#{m[0]}-#{m[1].downcase}" } + cname = cname.gsub(/^([A-Z])/) { |m| m.downcase } + cname + end + + def inspect ; "builtin/#{name}" ; end + def to_s ; name ; end + end end Dir[File.join(File.dirname(__FILE__), "builtin", "**/*.rb")].each {|f| require f }