This repository has been archived by the owner on Feb 7, 2020. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jakub Stastny
authored and
Jakub Stastny
committed
Oct 26, 2009
1 parent
418f755
commit c5c2c96
Showing
18 changed files
with
2,550 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
: release 1.0.0 (2006-03-12) | ||
- first release (1.0.0) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
= README | ||
|
||
revision:: $Rev: 1 $ | ||
release:: $Release: 1.0.0 $ | ||
copyright:: copyright(c) 2006 kuwata-lab.com all rights reserved. | ||
|
||
|
||
== Introduction | ||
|
||
'abstract.rb' is a library which enable you to define abstract method in Ruby. | ||
|
||
The followings are examples: | ||
|
||
## example1. (shorter notation) | ||
require 'rubygems' # if installed with 'gem install' | ||
require 'abstract' | ||
class Foo | ||
abstract_method 'arg1, arg2=""', :method1, :method2, :method3 | ||
end | ||
|
||
## example2. (RDoc friendly notation) | ||
require 'rubygems' # if installed with 'gem install' | ||
require 'abstract' | ||
class Bar | ||
# ... method1 description ... | ||
def method1(arg1, arg2="") | ||
not_implemented | ||
end | ||
# ... method2 description ... | ||
def method2(arg1, arg2="") | ||
not_implemented | ||
end | ||
end | ||
|
||
|
||
Abstract method makes your code more descriptive. | ||
It is useful even for dynamic language such as Ruby. | ||
|
||
|
||
== Installation | ||
|
||
|
||
* Type 'gem install -r abstract' with root account if you have installed RubyGems. | ||
|
||
* Or type 'ruby setup.rb' with root account if you can be root account. | ||
|
||
* Or copy lib/abstract.rb into proper directory such as '/usr/local/lib/ruby/site_ruby'. | ||
|
||
|
||
== License | ||
|
||
Ruby's | ||
|
||
|
||
== Copyright | ||
|
||
copyright(c) 2006 kuwata-lab.com all rights reserved. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#!/usr/bin/env ruby | ||
|
||
### | ||
### RubyGems Specification file for abstract.rb | ||
### | ||
### $Rev: 1 $ | ||
### $Release: 1.0.0 $ | ||
### copyright(c) 2006 kuwata-lab.com all rights reserved. | ||
### | ||
|
||
require 'rubygems' | ||
|
||
spec = Gem::Specification.new do |s| | ||
## package information | ||
s.name = 'abstract' | ||
s.author = 'makoto kuwata' | ||
s.version = ("$Release: 1.0.0 $" =~ /[\.\d]+/) && $& | ||
s.platform = Gem::Platform::RUBY | ||
s.homepage = 'http://rubyforge.org/projects/abstract' | ||
s.summary = "a library which enable you to define abstract method in Ruby" | ||
s.description = <<-'END' | ||
'abstract.rb' is a library which enable you to define abstract method in Ruby. | ||
END | ||
|
||
## files | ||
files = [] | ||
files += Dir.glob('lib/**/*') | ||
files += Dir.glob('test/**/*') | ||
files += %w[README.txt ChangeLog setup.rb abstract.gemspec] | ||
#s.files = files.delete_if { |path| path =~ /\.svn/ } | ||
s.files = files | ||
s.test_file = 'test/test.rb' | ||
end | ||
|
||
# Quick fix for Ruby 1.8.3 / YAML bug (thanks to Ross Bamford) | ||
if (RUBY_VERSION == '1.8.3') | ||
def spec.to_yaml | ||
out = super | ||
out = '--- ' + out unless out =~ /^---/ | ||
out | ||
end | ||
end | ||
|
||
if $0 == __FILE__ | ||
Gem::manage_gems | ||
Gem::Builder.new(spec).build | ||
end | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<!DOCTYPE html | ||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> | ||
<head> | ||
<title>Module: Kernel</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||
<meta http-equiv="Content-Script-Type" content="text/javascript" /> | ||
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" /> | ||
<script type="text/javascript"> | ||
// <![CDATA[ | ||
|
||
function popupCode( url ) { | ||
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400") | ||
} | ||
|
||
function toggleCode( id ) { | ||
if ( document.getElementById ) | ||
elem = document.getElementById( id ); | ||
else if ( document.all ) | ||
elem = eval( "document.all." + id ); | ||
else | ||
return false; | ||
|
||
elemStyle = elem.style; | ||
|
||
if ( elemStyle.display != "block" ) { | ||
elemStyle.display = "block" | ||
} else { | ||
elemStyle.display = "none" | ||
} | ||
|
||
return true; | ||
} | ||
|
||
// Make codeblocks hidden by default | ||
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" ) | ||
|
||
// ]]> | ||
</script> | ||
|
||
</head> | ||
<body> | ||
|
||
|
||
|
||
<div id="classHeader"> | ||
<table class="header-table"> | ||
<tr class="top-aligned-row"> | ||
<td><strong>Module</strong></td> | ||
<td class="class-name-in-header">Kernel</td> | ||
</tr> | ||
<tr class="top-aligned-row"> | ||
<td><strong>In:</strong></td> | ||
<td> | ||
<a href="../files/lib/abstract_rb.html"> | ||
lib/abstract.rb | ||
</a> | ||
<br /> | ||
</td> | ||
</tr> | ||
|
||
</table> | ||
</div> | ||
<!-- banner header --> | ||
|
||
<div id="bodyContent"> | ||
|
||
|
||
|
||
<div id="contextContent"> | ||
|
||
|
||
|
||
</div> | ||
|
||
<div id="method-list"> | ||
<h3 class="section-bar">Methods</h3> | ||
|
||
<div class="name-list"> | ||
<a href="#M000002">not_implemented</a> | ||
</div> | ||
</div> | ||
|
||
</div> | ||
|
||
|
||
<!-- if includes --> | ||
|
||
<div id="section"> | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
<!-- if method_list --> | ||
<div id="methods"> | ||
<h3 class="section-bar">Private Instance methods</h3> | ||
|
||
<div id="method-M000002" class="method-detail"> | ||
<a name="M000002"></a> | ||
|
||
<div class="method-heading"> | ||
<a href="Kernel.src/M000002.html" target="Code" class="method-signature" | ||
onclick="popupCode('Kernel.src/M000002.html');return false;"> | ||
<span class="method-name">not_implemented</span><span class="method-args">(</span> | ||
</a> | ||
</div> | ||
|
||
<div class="method-description"> | ||
<p> | ||
raise NotImplementedError | ||
</p> | ||
</div> | ||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
</div> | ||
|
||
|
||
<div id="validator-badges"> | ||
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p> | ||
</div> | ||
|
||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="iso-8859-1"?> | ||
<!DOCTYPE html | ||
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" | ||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> | ||
|
||
<html> | ||
<head> | ||
<title>not_implemented (Kernel)</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> | ||
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" /> | ||
</head> | ||
<body class="standalone-code"> | ||
<pre><span class="ruby-comment cmt"># File lib/abstract.rb, line 65</span> | ||
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">not_implemented</span> <span class="ruby-comment cmt">#:doc:</span> | ||
<span class="ruby-identifier">backtrace</span> = <span class="ruby-identifier">caller</span>() | ||
<span class="ruby-identifier">method_name</span> = (<span class="ruby-identifier">backtrace</span>.<span class="ruby-identifier">shift</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/`(\w+)'$/</span>) <span class="ruby-operator">&&</span> <span class="ruby-identifier">$1</span> | ||
<span class="ruby-identifier">mesg</span> = <span class="ruby-node">"class #{self.class.name} must implement abstract method '#{method_name}()'."</span> | ||
<span class="ruby-comment cmt">#mesg = "#{self.class.name}##{method_name}() is not implemented."</span> | ||
<span class="ruby-identifier">err</span> = <span class="ruby-constant">NotImplementedError</span>.<span class="ruby-identifier">new</span> <span class="ruby-identifier">mesg</span> | ||
<span class="ruby-identifier">err</span>.<span class="ruby-identifier">set_backtrace</span> <span class="ruby-identifier">backtrace</span> | ||
<span class="ruby-identifier">raise</span> <span class="ruby-identifier">err</span> | ||
<span class="ruby-keyword kw">end</span></pre> | ||
</body> | ||
</html> |
Oops, something went wrong.