acts_as_interface 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -10,5 +10,5 @@ group :development do
10
10
  gem "bundler", "~> 1.0.0"
11
11
  gem "jeweler", "~> 1.5.2"
12
12
  gem "rcov", ">= 0"
13
- gem "activesupport", "2.3.4"
13
+ gem "activesupport", ">= 2.3.4"
14
14
  end
data/README.rdoc CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  == INSTALL
4
4
 
5
- gem install timecop
5
+ gem install acts_as_interface
6
6
 
7
7
  == DESCRIPTION
8
8
 
@@ -38,7 +38,7 @@ In the spirit of self documenting code, acts_as_interface allows you to easily d
38
38
  Student.foo #raises NotImplementedError
39
39
 
40
40
 
41
- === MODULE
41
+ === MODULE (on include)
42
42
 
43
43
  module ActsAsPerson
44
44
  def self.included(base)
@@ -58,6 +58,34 @@ In the spirit of self documenting code, acts_as_interface allows you to easily d
58
58
  student = Student.first
59
59
  student.name #works as usual
60
60
  student.dance #raises NotImplementedError
61
+
62
+ === MODULE (from method call)
63
+
64
+ module ActsAsPerson
65
+ module ClassMethods
66
+ def acts_as_person
67
+ include ActsAsInterface
68
+ abstract_methods :name, :dance
69
+ end
70
+ end
71
+
72
+ def self.included(base)
73
+ base.extend(ClassMethods)
74
+ end
75
+ end
76
+
77
+ class Student < ActiveRecord::Base
78
+ include acts_as_person
79
+
80
+ #include or invoke modules that defines name but not dance
81
+
82
+ acts_as_person #apply interface
83
+ end
84
+
85
+ student = Student.first
86
+ student.name #works as usual
87
+ student.dance #raises NotImplementedError
88
+
61
89
 
62
90
  == CONTRIBUTING
63
91
 
data/Rakefile CHANGED
@@ -21,7 +21,7 @@ Jeweler::Tasks.new do |gem|
21
21
  gem.authors = ["Philippe Huibonhoa"]
22
22
  # Include your dependencies below. Runtime dependencies are required when using your gem,
23
23
  # and development dependencies are only needed for development (ie running rake tasks, tests, etc)
24
- # gem.add_runtime_dependency 'jabber4r', '> 0.1'
24
+ gem.add_runtime_dependency 'activesupport', '>= 2.3.4'
25
25
  # gem.add_development_dependency 'rspec', '> 1.2.3'
26
26
  end
27
27
  Jeweler::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{acts_as_interface}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Philippe Huibonhoa"]
12
- s.date = %q{2011-01-27}
12
+ s.date = %q{2011-02-04}
13
13
  s.description = %q{Easily define abstract methods and callbacks for superclasses and modules}
14
14
  s.email = %q{philippe.huibonhoa@bookrenter.com}
15
15
  s.extra_rdoc_files = [
@@ -47,20 +47,23 @@ Gem::Specification.new do |s|
47
47
  s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
48
48
  s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
49
49
  s.add_development_dependency(%q<rcov>, [">= 0"])
50
- s.add_development_dependency(%q<activesupport>, ["= 2.3.4"])
50
+ s.add_development_dependency(%q<activesupport>, [">= 2.3.4"])
51
+ s.add_runtime_dependency(%q<activesupport>, [">= 2.3.4"])
51
52
  else
52
53
  s.add_dependency(%q<shoulda>, [">= 0"])
53
54
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
54
55
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
55
56
  s.add_dependency(%q<rcov>, [">= 0"])
56
- s.add_dependency(%q<activesupport>, ["= 2.3.4"])
57
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
58
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
57
59
  end
58
60
  else
59
61
  s.add_dependency(%q<shoulda>, [">= 0"])
60
62
  s.add_dependency(%q<bundler>, ["~> 1.0.0"])
61
63
  s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
62
64
  s.add_dependency(%q<rcov>, [">= 0"])
63
- s.add_dependency(%q<activesupport>, ["= 2.3.4"])
65
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
66
+ s.add_dependency(%q<activesupport>, [">= 2.3.4"])
64
67
  end
65
68
  end
66
69
 
@@ -1,5 +1,3 @@
1
- require 'active_support'
2
-
3
1
  #Include ActsAsInterface to easily define abstract methods
4
2
  #Example: Superclass
5
3
  # class Person
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: acts_as_interface
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 25
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 0
10
- version: 0.1.0
9
+ - 1
10
+ version: 0.1.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Philippe Huibonhoa
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-27 00:00:00 -08:00
18
+ date: 2011-02-04 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -82,7 +82,7 @@ dependencies:
82
82
  requirement: &id005 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
- - - "="
85
+ - - ">="
86
86
  - !ruby/object:Gem::Version
87
87
  hash: 11
88
88
  segments:
@@ -94,6 +94,22 @@ dependencies:
94
94
  name: activesupport
95
95
  prerelease: false
96
96
  version_requirements: *id005
97
+ - !ruby/object:Gem::Dependency
98
+ requirement: &id006 !ruby/object:Gem::Requirement
99
+ none: false
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ hash: 11
104
+ segments:
105
+ - 2
106
+ - 3
107
+ - 4
108
+ version: 2.3.4
109
+ type: :runtime
110
+ name: activesupport
111
+ prerelease: false
112
+ version_requirements: *id006
97
113
  description: Easily define abstract methods and callbacks for superclasses and modules
98
114
  email: philippe.huibonhoa@bookrenter.com
99
115
  executables: []