inheritance-helper 0.1.0 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80340efe6c30e437ccf8d0096f09006c66718304efc3ecc6752392c2fd7e4e57
4
- data.tar.gz: 7cb1b052663f71890dd0014c7ff0fad56b9998bf1bcb1bbbde59631e9971eaf6
3
+ metadata.gz: d0f85893db0cee390f4b58baef82b83bb11d082c6d7d3780d58de9cd8229e43c
4
+ data.tar.gz: 232920ab9049c25601cb2ec27240ceecb0978896e4e72e774ee51e93059081a4
5
5
  SHA512:
6
- metadata.gz: eae4098f0a2ec38626cec9ff96a193b3d105c3cab447e213217fa5fec155b8133e6d80f1029e68e9f260f6639f0146cfd2c458779c9dea7c2d32b5be0b8934b6
7
- data.tar.gz: db2b843296110fbac9aa82366d371381ca5b41c3802a05dbc1a70dec9799dc81c69f5741c7768ecc39ad9641690ee1b8ce625db0f0b3e9810f3a8c51c9c78e37
6
+ metadata.gz: 0ec786e803b3cb1ef0df9382bb590fa599e61a310d749094c538a1e21562f4b7ad75d3208a8611c172cf74e132aa5153916b010ed66efcecde1b3ecb4fb399b1
7
+ data.tar.gz: 7b86cb3dfd5cce00deeb15ea469a19e2743505cef16797cc17942a243670d26f80b5868d126d2a3456c113af5493b6529d3cc35e5f40e660e5b92066bda12d86
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # A set of utility classes for making inheritance work with class level variables
3
4
  module InheritanceHelper
4
5
  autoload :Methods, 'inheritance-helper/methods'
5
6
  end
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module InheritanceHelper
4
+ # Collection of utility methods for rewriting class methods
4
5
  module Methods
5
6
  def self.redefine_class_method(klass, method, value)
6
7
  class << klass; self; end.send(:define_method, method) { value }
@@ -11,6 +12,8 @@ module InheritanceHelper
11
12
  ::InheritanceHelper::Methods.redefine_class_method(self, method, value)
12
13
  end
13
14
 
15
+ # useful for adding data to hashes.
16
+ # when working with arrays it keeps a flat data set
14
17
  def add_value_to_class_method(method, value)
15
18
  old_value = send(method)
16
19
 
@@ -24,5 +27,12 @@ module InheritanceHelper
24
27
 
25
28
  redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)
26
29
  end
30
+
31
+ # useful for working with arrays and maintain a list of values
32
+ def append_value_to_class_method(method, value)
33
+ old_value = send(method)
34
+ new_value = old_value.dup << value
35
+ redefine_class_method(method, old_value.frozen? ? new_value.freeze : new_value)
36
+ end
27
37
  end
28
38
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: inheritance-helper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Doug Youch
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-30 00:00:00.000000000 Z
11
+ date: 2019-09-13 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Redefines class methods
14
14
  email: dougyouch+github@gmail.com
@@ -19,7 +19,8 @@ files:
19
19
  - lib/inheritance-helper.rb
20
20
  - lib/inheritance-helper/methods.rb
21
21
  homepage: https://github.com/dougyouch/inheritance-helper
22
- licenses: []
22
+ licenses:
23
+ - MIT
23
24
  metadata: {}
24
25
  post_install_message:
25
26
  rdoc_options: []
@@ -36,8 +37,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
36
37
  - !ruby/object:Gem::Version
37
38
  version: '0'
38
39
  requirements: []
39
- rubyforge_project:
40
- rubygems_version: 2.7.6
40
+ rubygems_version: 3.0.3
41
41
  signing_key:
42
42
  specification_version: 4
43
43
  summary: Inheritance Helpers