diff options
author | makoto kuwata <kwa@kuwata-lab.com> | 2011-03-21 09:47:05 +0900 |
---|---|---|
committer | makoto kuwata <kwa@kuwata-lab.com> | 2011-03-21 09:47:05 +0900 |
commit | a0441cc7f68abcde11eb8fc6111c8d0fb9f925a8 (patch) | |
tree | 6d5cf54d521a44412bfec23b89aa5fadaf0c6f3c | |
parent | 5f4e4cd9bbe277d6b8ab40b4ba7ff06ffec0dec9 (diff) | |
download | erubis-a0441cc7f68abcde11eb8fc6111c8d0fb9f925a8.tar.gz |
[enhance] add 'lib/erubis/util.rb' which contains 'Kernel#not_implemented()'
-rw-r--r-- | lib/erubis.rb | 1 | ||||
-rw-r--r-- | lib/erubis/util.rb | 22 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/erubis.rb b/lib/erubis.rb index 0c2071b..92d6507 100644 --- a/lib/erubis.rb +++ b/lib/erubis.rb @@ -56,6 +56,7 @@ require 'erubis/engine' #require 'erubis/evaluator' #require 'erubis/error' #require 'erubis/context' +#requier 'erubis/util' require 'erubis/helper' require 'erubis/enhancer' #require 'erubis/tiny' diff --git a/lib/erubis/util.rb b/lib/erubis/util.rb new file mode 100644 index 0000000..d1611ce --- /dev/null +++ b/lib/erubis/util.rb @@ -0,0 +1,22 @@ +## +## $Release:$ +## $Copyright$ +## + +module Kernel + + ## + ## raise NotImplementedError + ## + def not_implemented #:doc: + backtrace = caller() + method_name = (backtrace.shift =~ /`(\w+)'$/) && $1 + mesg = "class #{self.class.name} must implement abstract method '#{method_name}()'." + #mesg = "#{self.class.name}##{method_name}() is not implemented." + err = NotImplementedError.new mesg + err.set_backtrace backtrace + raise err + end + private :not_implemented + +end |