konstructor 0.4.1 → 0.4.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 44c51074d47f8b7b6fef07e36772b81c4fc5de71
4
- data.tar.gz: 840b1dea7dee69bceb9595d73d76a9722bc87455
3
+ metadata.gz: b268a5dc2f6be4998f6e18b900afc84d53ca9362
4
+ data.tar.gz: 102b9d190a66c3b93aa33dd76010f8a568294d26
5
5
  SHA512:
6
- metadata.gz: 6b245d765c1dde3f18b88e4efe57f597cb9057d63eaebf100c04d94fa22cfbb2dd2890260590fed106a3a88a301f83b1a5bbca659fb2d86367ee977313291e9d
7
- data.tar.gz: f7e2d3ff8a3382fdf764829e32cda532a27257c57f12d6391fe5eaebf1852b493bd12db5afdf6d6f129528639bb5c0e856fc162b7d1d52e776db3834db588b77
6
+ metadata.gz: 21c464c814b1a1f17964a615b3f443040fffe97fe2406c7f9b2dc7fb2b7b9d509b92ba722305d81bbeae99666a6fed6bb4e59992ce9cb9c68b15efb36ed2ce72
7
+ data.tar.gz: b4dcf94cc6ff9ee49f1144aa2f89683480bd98a7beeb268ebf395932ef1c441153d9e40004fdc9ecd2cf0d004c2404ed1ceacbd3c4c2e93cdde50b7f340f3b2f
@@ -1,4 +1,4 @@
1
-
1
+ # :nodoc:
2
2
  class Class
3
3
 
4
4
  include Konstructor::KonstructorMethod
@@ -1,5 +1,6 @@
1
1
  module Konstructor
2
2
 
3
+ # Base class for all Konstructor errors.
3
4
  class Error < StandardError
4
5
  end
5
6
 
@@ -1,4 +1,5 @@
1
1
  module Konstructor
2
+ # :nodoc:
2
3
  class Factory
3
4
 
4
5
  def initialize(klass)
@@ -16,9 +17,6 @@ module Konstructor
16
17
  end
17
18
  end
18
19
 
19
- # once method is a konstructor, it is always a konstructor, this differs
20
- # from the way private, protected works, if overriding method isn't repeatedly marked as private
21
- # it becomes public
22
20
  def declared?(name)
23
21
  declared_in_self?(name) || declared_in_superclass?(name)
24
22
  end
@@ -1,7 +1,9 @@
1
1
  module Konstructor
2
+ # :nodoc:
2
3
  module KonstructorMethodHook
3
4
 
4
- # Experimental and currently not used method_added hook approach protecting against method_added
5
+ # Experimental and currently not used <code>method_added</code>
6
+ # hook approach protecting against method_added
5
7
  # overrides that are not calling super (hopefully, there is no such code in the wild).
6
8
  #
7
9
  # Since method_added hook is idempotent, there would be no harm done even if
@@ -8,6 +8,7 @@ module Konstructor
8
8
  module KonstructorMethod
9
9
  private
10
10
 
11
+ # :doc:
11
12
  # konstructor -> nil
12
13
  # konstructor(symbol, ...) -> nil
13
14
  # konstructor(string, ...) -> nil
@@ -74,26 +75,29 @@ module Konstructor
74
75
  DEFAULT_NAMES.include?(name.to_sym)
75
76
  end
76
77
 
77
- def declared?(klass, name)
78
+ # Once method is a konstructor, it is always a konstructor, this differs
79
+ # from the way private, protected works. If overriding method isn't repeatedly
80
+ # marked as private it becomes public.
81
+ def declared?(klass, method_name)
78
82
  konstructor = get_factory(klass)
79
83
  if konstructor
80
- konstructor.declared?(name.to_sym)
84
+ konstructor.declared?(method_name.to_sym)
81
85
  else
82
86
  false
83
87
  end
84
88
  end
85
89
 
86
- def declare(klass, new_names)
90
+ def declare(klass, new_method_names)
87
91
  setup_method_added_hook(klass)
88
- get_or_init_factory(klass).declare(new_names)
92
+ get_or_init_factory(klass).declare(new_method_names)
89
93
  end
90
94
 
91
- def method_added_to_klass(klass, name)
92
- get_or_init_factory(klass).method_added_to_klass(name)
95
+ def method_added_to_klass(klass, method_name)
96
+ get_or_init_factory(klass).method_added_to_klass(method_name)
93
97
  end
94
98
 
95
- def is?(klass, name)
96
- default?(name) || declared?(klass, name)
99
+ def is?(klass, method_name)
100
+ default?(method_name) || declared?(klass, method_name)
97
101
  end
98
102
 
99
103
  private
@@ -1,4 +1,5 @@
1
1
  module Konstructor
2
+ # :nodoc:
2
3
  module SimpleMethodHook
3
4
 
4
5
  private
@@ -1,3 +1,3 @@
1
1
  module Konstructor
2
- VERSION = '0.4.1'
2
+ VERSION = '0.4.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: konstructor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dima Lashkov