Skip to content
This repository has been archived by the owner on Feb 7, 2020. It is now read-only.

Commit

Permalink
Added abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakub Stastny authored and Jakub Stastny committed Oct 26, 2009
1 parent 418f755 commit c5c2c96
Show file tree
Hide file tree
Showing 18 changed files with 2,550 additions and 0 deletions.
3 changes: 3 additions & 0 deletions vendor/abstract/ChangeLog
@@ -0,0 +1,3 @@
: release 1.0.0 (2006-03-12)
- first release (1.0.0)

57 changes: 57 additions & 0 deletions vendor/abstract/README.txt
@@ -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.
48 changes: 48 additions & 0 deletions vendor/abstract/abstract.gemspec
@@ -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

134 changes: 134 additions & 0 deletions vendor/abstract/doc/classes/Kernel.html
@@ -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>&nbsp;&nbsp;
</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>
24 changes: 24 additions & 0 deletions vendor/abstract/doc/classes/Kernel.src/M000002.html
@@ -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">&amp;&amp;</span> <span class="ruby-identifier">$1</span>
<span class="ruby-identifier">mesg</span> = <span class="ruby-node">&quot;class #{self.class.name} must implement abstract method '#{method_name}()'.&quot;</span>
<span class="ruby-comment cmt">#mesg = &quot;#{self.class.name}##{method_name}() is not implemented.&quot;</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>

0 comments on commit c5c2c96

Please sign in to comment.