mixin 1.0.0 → 1.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/README +9 -9
  2. data/lib/mixin.rb +1 -1
  3. metadata +11 -11
data/README CHANGED
@@ -7,7 +7,7 @@ when it comes to defining class methods.
7
7
  Typically, the way to implement a mixin that defines class methods for its
8
8
  includees (at least that I have noticed) is to define a module within the mixin
9
9
  module, usually called +ClassMethods+, which gets automatically extended to an
10
- including class by overwriting the mixin's +inherited+ method. This technique
10
+ including class by overwriting the mixin's +included+ method. This technique
11
11
  is usually sufficient for most situations, but it has a few limitations. One of
12
12
  these is the fact that class attributes referenced in +ClassMethods+ do not
13
13
  exist in the same scope as the enclosing mixin's class attributes.
@@ -16,17 +16,17 @@ exist in the same scope as the enclosing mixin's class attributes.
16
16
 
17
17
  Mixin comes in handy in following situations:
18
18
 
19
- * When you are writing a mixin with class methods that need to access class
20
- attributes defined within the mixin module.
19
+ * When you are writing a mixin with class methods that need to access <b>class
20
+ attributes</b> defined within the mixin module.
21
21
 
22
22
  * When you want to define a "sub-mixin" module which includes another mixin
23
- in order to expand upon its class methods in addition to its instance methods
24
- (similar to defining a hierarchy of abstract base classes). This includes calls
25
- to +super+ to invoke a "super-mixin's" implementation of a given class method.
23
+ in order to expand upon its class methods in addition to its instance methods.
24
+ This includes <b>calls to +super+</b> to invoke a "super-mixin's" implementation
25
+ of a given class method.
26
26
 
27
- * When you simply get tired of writing the same old "<tt>def self.inherited(base);
28
- base.extend(ClassMethods)</tt>" method (or some variation of it) over and over
29
- again, thereby violating the sacred DRY principle ;)
27
+ * When you simply <b>get tired of writing</b> the same old <b>"<tt>def self.included(base);
28
+ base.extend(ClassMethods)</tt>"</b> method (or some variation of it) <b>over and over
29
+ again</b>, thereby violating the sacred DRY principle ;)
30
30
 
31
31
  == Examples
32
32
 
@@ -74,7 +74,7 @@ module Mixin
74
74
 
75
75
  def __class_mixin__
76
76
  cm = ClassMixin.new(self)
77
- (class << self; self; end).module_eval do
77
+ (class << self; self; end).instance_eval do
78
78
  define_method(:__class_mixin__) { cm }
79
79
  private :__class_mixin__
80
80
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mixin
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
4
+ hash: 21
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 0
10
- version: 1.0.0
9
+ - 1
10
+ version: 1.0.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Hersch Stevenson (xian)
@@ -15,11 +15,11 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-03-09 00:00:00 -08:00
18
+ date: 2011-03-10 00:00:00 -08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
22
- description: Mixins made classier!
22
+ description: Mixins made classier
23
23
  email: stevenson@persapient.com
24
24
  executables: []
25
25
 
@@ -30,17 +30,17 @@ extra_rdoc_files:
30
30
  - LICENSE
31
31
  files:
32
32
  - lib/mixin.rb
33
- - test/mixin_case.rb
34
- - test/test_subjects/clevers.rb
33
+ - test/test_subjects/scopers.rb
34
+ - test/test_subjects/meepers.rb
35
35
  - test/test_subjects/extenders.rb
36
+ - test/test_subjects/sleepers.rb
37
+ - test/test_subjects/clevers.rb
36
38
  - test/test_subjects/hopons.rb
37
- - test/test_subjects/includers.rb
38
- - test/test_subjects/meepers.rb
39
39
  - test/test_subjects/nudgers.rb
40
- - test/test_subjects/scopers.rb
41
- - test/test_subjects/sleepers.rb
40
+ - test/test_subjects/includers.rb
42
41
  - test/test_subjects/soopers.rb
43
42
  - test/test_subjects/weirdos.rb
43
+ - test/mixin_case.rb
44
44
  - README
45
45
  - LICENSE
46
46
  - Rakefile