presentable 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/Rakefile +26 -0
- data/VERSION +1 -1
- data/lib/presenter.rb +9 -5
- data/presentable.gemspec +55 -0
- data/test/presenter_test.rb +11 -0
- metadata +5 -2
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
*.gem
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
require 'rake/testtask'
|
4
|
+
require 'rake/rdoctask'
|
5
|
+
|
6
|
+
begin
|
7
|
+
require 'jeweler'
|
8
|
+
Jeweler::Tasks.new do |g|
|
9
|
+
g.name = 'presentable'
|
10
|
+
g.summary = %(Making presenters easy and fun!)
|
11
|
+
g.description = %(Making presenters easy and fun!)
|
12
|
+
g.email = 'matt@toastyapps.com'
|
13
|
+
g.homepage = 'http://github.com/toastyapps/presentable'
|
14
|
+
g.authors = %w(toastyapps)
|
15
|
+
end
|
16
|
+
Jeweler::GemcutterTasks.new
|
17
|
+
rescue LoadError
|
18
|
+
puts 'Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com'
|
19
|
+
end
|
20
|
+
|
21
|
+
Rake::TestTask.new do |t|
|
22
|
+
t.libs = %w(test)
|
23
|
+
t.pattern = 'test/**/*_test.rb'
|
24
|
+
end
|
25
|
+
|
26
|
+
task :default => :test
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/presenter.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
1
|
class Presenter
|
2
|
-
instance_methods.each do |method|
|
3
|
-
undef_method(method) unless method =~ /^__/
|
4
|
-
end
|
5
2
|
|
6
3
|
attr_accessor :context
|
7
|
-
def initialize(context)
|
8
|
-
|
4
|
+
def initialize(context = nil)
|
5
|
+
if context
|
6
|
+
@context = context
|
7
|
+
class << self
|
8
|
+
Object.instance_methods.each do |method|
|
9
|
+
undef_method(method) unless method =~ /^__/ || method == 'method_missing'
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
9
13
|
end
|
10
14
|
|
11
15
|
def method_missing(method, *args, &block)
|
data/presentable.gemspec
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{presentable}
|
8
|
+
s.version = "0.1.0"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["toastyapps"]
|
12
|
+
s.date = %q{2009-12-17}
|
13
|
+
s.description = %q{Making presenters easy and fun!}
|
14
|
+
s.email = %q{matt@toastyapps.com}
|
15
|
+
s.files = [
|
16
|
+
".gitignore",
|
17
|
+
"Rakefile",
|
18
|
+
"Readme.textile",
|
19
|
+
"VERSION",
|
20
|
+
"lib/presentable.rb",
|
21
|
+
"lib/presenter.rb",
|
22
|
+
"presentable.gemspec",
|
23
|
+
"rails/init.rb",
|
24
|
+
"test/presenter_test.rb",
|
25
|
+
"test/presenters/post_presenter.rb",
|
26
|
+
"test/presenters/post_rss_presenter.rb",
|
27
|
+
"test/presenters/rss_presenter.rb",
|
28
|
+
"test/schema.rb",
|
29
|
+
"test/test_helper.rb"
|
30
|
+
]
|
31
|
+
s.homepage = %q{http://github.com/toastyapps/presentable}
|
32
|
+
s.rdoc_options = ["--charset=UTF-8"]
|
33
|
+
s.require_paths = ["lib"]
|
34
|
+
s.rubygems_version = %q{1.3.5}
|
35
|
+
s.summary = %q{Making presenters easy and fun!}
|
36
|
+
s.test_files = [
|
37
|
+
"test/presenter_test.rb",
|
38
|
+
"test/presenters/post_presenter.rb",
|
39
|
+
"test/presenters/post_rss_presenter.rb",
|
40
|
+
"test/presenters/rss_presenter.rb",
|
41
|
+
"test/schema.rb",
|
42
|
+
"test/test_helper.rb"
|
43
|
+
]
|
44
|
+
|
45
|
+
if s.respond_to? :specification_version then
|
46
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
+
s.specification_version = 3
|
48
|
+
|
49
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
50
|
+
else
|
51
|
+
end
|
52
|
+
else
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
data/test/presenter_test.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
+
require 'test_helper'
|
4
|
+
|
3
5
|
class PresenterTest < Test::Unit::TestCase
|
4
6
|
def test_presenter
|
5
7
|
post = Post.new.presenter
|
@@ -20,4 +22,13 @@ class PresenterTest < Test::Unit::TestCase
|
|
20
22
|
assert post.is_post_presenter?
|
21
23
|
assert post.is_rss_presenter?
|
22
24
|
end
|
25
|
+
|
26
|
+
|
27
|
+
def test_class
|
28
|
+
post = Post.new.presenter
|
29
|
+
assert_equal Post, post.class
|
30
|
+
rss = RssPresenter.new
|
31
|
+
puts rss.methods.sort.inspect
|
32
|
+
assert_equal RssPresenter, rss.class
|
33
|
+
end
|
23
34
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: presentable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- toastyapps
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-12-
|
12
|
+
date: 2009-12-17 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -22,10 +22,13 @@ extensions: []
|
|
22
22
|
extra_rdoc_files: []
|
23
23
|
|
24
24
|
files:
|
25
|
+
- .gitignore
|
26
|
+
- Rakefile
|
25
27
|
- Readme.textile
|
26
28
|
- VERSION
|
27
29
|
- lib/presentable.rb
|
28
30
|
- lib/presenter.rb
|
31
|
+
- presentable.gemspec
|
29
32
|
- rails/init.rb
|
30
33
|
- test/presenter_test.rb
|
31
34
|
- test/presenters/post_presenter.rb
|