siefca-bufferaffects 0.0.8 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,48 @@
1
+
2
+ module AttrInheritable
3
+
4
+ def self.included(base) #:nodoc:
5
+ base.extend(ClassMethods)
6
+ end
7
+
8
+ module ClassMethods
9
+
10
+ def attr_inheritable(*variables)
11
+ variables.each do |v|
12
+ module_eval %{
13
+ def #{v}
14
+ @#{v} = superclass.#{v} if !instance_variable_defined?(:@#{v}) && superclass.respond_to?(:#{v})
15
+ @#{v} ||= nil
16
+ return @#{v}
17
+ end
18
+ }
19
+ end
20
+ end
21
+
22
+ def attr_inheritable_hash(*variables)
23
+ variables.each do |v|
24
+ module_eval %{
25
+ def #{v}
26
+ @#{v} = superclass.#{v} if !instance_variable_defined?(:@#{v}) && superclass.respond_to?(:#{v})
27
+ @#{v} ||= {}
28
+ return @#{v}
29
+ end
30
+ }
31
+ end
32
+ end
33
+
34
+ def attr_inheritable_array(*variables)
35
+ variables.each do |v|
36
+ module_eval %{
37
+ def #{v}
38
+ @#{v} = superclass.#{v} if !instance_variable_defined?(:@#{v}) && superclass.respond_to?(:#{v})
39
+ if @#{v} ||= []
40
+ return @#{v}
41
+ end
42
+ }
43
+ end
44
+ end
45
+
46
+ end
47
+
48
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: siefca-bufferaffects
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Pawe\xC5\x82 Wilk"
@@ -24,6 +24,7 @@ extra_rdoc_files: []
24
24
  files:
25
25
  - lib/bufferaffects.rb
26
26
  - lib/bufferaffects/bufferaffects.rb
27
+ - lib/bufferaffects/attr_inheritable.rb
27
28
  has_rdoc: true
28
29
  homepage: http://randomseed.pl/bufferaffects
29
30
  post_install_message: