scoped_attr_accessor 1.0.0 → 1.0.1

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.
data/README.md CHANGED
@@ -6,54 +6,6 @@ scope of code that comes afterward. You can extend a single class (and
6
6
  its subclasses) with scoped accessors, or you can extend ruby's entire
7
7
  class hierarchy.
8
8
 
9
- ## Why Oh Why Does This Exist?!?
10
-
11
- At the time of this writing (April 2013), the ruby community in
12
- general is somewhat divided on the meaning of the concept of privacy
13
- in ruby. For some, especially those who come from Java, C++, VB, or
14
- some other language that enforces encapsulation with privacy, ruby's
15
- ability to get around privacy means that encapsulation cannot be
16
- enforced. Most of us (I count myself in this camp) have discarded the
17
- use of privacy in ruby altogether, as if it were nothing more than a
18
- half-hearted nod to other languages' encapsulation practices. Make
19
- everything public, since everything's ultimately public anyway, we
20
- say; using the private keyword is merely a speedbump which adds no
21
- security but does add hassle and headache.
22
-
23
- I am becoming more and more aware of a number of rubyists who consider
24
- the use of private and protected methods in ruby to be a useful way to
25
- communicate to the reader that the code is highly volatile, under
26
- question, subject to change or outright removal, etc., and that for
27
- these reasons the code should not be surfaced to the public API of the
28
- class. They ALSO consider the private keyword to be merely a
29
- speedbump, but one which communicates that maybe you should slow down
30
- a bit before trying to access these portions of code. Furthermore,
31
- making these methods private or protected makes them "exemplary" to
32
- maintainers of the code, meaning that a maintainer will understand the
33
- intent of the privacy, and be less likely to *accidentally* create an
34
- external dependency on on a method that should have been kept private.
35
-
36
- I am becoming more and more swayed by this second way of thinking, but
37
- I find that it falls short in one key area: accessors. It is easy to
38
- create a private method in ruby, but creating a private accessor
39
- method is actually a bit tortuous. As a result, I see programmers who
40
- strongly believe in using privacy to communicate undependable
41
- interfaces frequently making use of either instance variables or
42
- public accessors for their private variables. These variables are not
43
- dependable, at least from a "stable interface" standpoint, so both
44
- solutions offer an unfavorable tradeoff. While instance variables
45
- communicate privacy, they force the object to depend on its own
46
- undependable internal interface. Meanwhile, public accessors allow the
47
- class to isolate itself from its undependable interface, but by making
48
- it public the communication to the maintainer is that other classes
49
- can and should depend on that undependable interface.
50
-
51
- The reason programmers make this tradeoff is that there doesn't seem
52
- to be an easy, clean, *elegant* way to create private and protected
53
- accessors in ruby. My goal with this gem, then, is to create such a
54
- way, so that those who wish to communicate "this variable is
55
- undependable and it should be kept isolated for now" can do so easily.
56
-
57
9
  ## Installation
58
10
 
59
11
  Add this line to your application's Gemfile:
@@ -125,3 +77,51 @@ Tested to work on Ruby 1.9.3 and 2.0.
125
77
  1. Commit your changes (`git commit -am 'Add some feature'`)
126
78
  1. Push to the branch (`git push origin my-new-feature`)
127
79
  1. Create new Pull Request
80
+
81
+ ## Why Oh Why Does This Exist?!?
82
+
83
+ At the time of this writing (April 2013), the ruby community in
84
+ general is somewhat divided on the meaning of the concept of privacy
85
+ in ruby. For some, especially those who come from Java, C++, VB, or
86
+ some other language that enforces encapsulation with privacy, ruby's
87
+ ability to get around privacy means that encapsulation cannot be
88
+ enforced. Most of us (I count myself in this camp) have discarded the
89
+ use of privacy in ruby altogether, as if it were nothing more than a
90
+ half-hearted nod to other languages' encapsulation practices. Make
91
+ everything public, since everything's ultimately public anyway, we
92
+ say; using the private keyword is merely a speedbump which adds no
93
+ security but does add hassle and headache.
94
+
95
+ I am becoming more and more aware of a number of rubyists who consider
96
+ the use of private and protected methods in ruby to be a useful way to
97
+ communicate to the reader that the code is highly volatile, under
98
+ question, subject to change or outright removal, etc., and that for
99
+ these reasons the code should not be surfaced to the public API of the
100
+ class. They ALSO consider the private keyword to be merely a
101
+ speedbump, but one which communicates that maybe you should slow down
102
+ a bit before trying to access these portions of code. Furthermore,
103
+ making these methods private or protected makes them "exemplary" to
104
+ maintainers of the code, meaning that a maintainer will understand the
105
+ intent of the privacy, and be less likely to *accidentally* create an
106
+ external dependency on on a method that should have been kept private.
107
+
108
+ I am becoming more and more swayed by this second way of thinking, but
109
+ I find that it falls short in one key area: accessors. It is easy to
110
+ create a private method in ruby, but creating a private accessor
111
+ method is actually a bit tortuous. As a result, I see programmers who
112
+ strongly believe in using privacy to communicate undependable
113
+ interfaces frequently making use of either instance variables or
114
+ public accessors for their private variables. These variables are not
115
+ dependable, at least from a "stable interface" standpoint, so both
116
+ solutions offer an unfavorable tradeoff. While instance variables
117
+ communicate privacy, they force the object to depend on its own
118
+ undependable internal interface. Meanwhile, public accessors allow the
119
+ class to isolate itself from its undependable interface, but by making
120
+ it public the communication to the maintainer is that other classes
121
+ can and should depend on that undependable interface.
122
+
123
+ The reason programmers make this tradeoff is that there doesn't seem
124
+ to be an easy, clean, *elegant* way to create private and protected
125
+ accessors in ruby. My goal with this gem, then, is to create such a
126
+ way, so that those who wish to communicate "this variable is
127
+ undependable and it should be kept isolated for now" can do so easily.
@@ -1,3 +1,3 @@
1
1
  module ScopedAttrAccessor
2
- VERSION = "1.0.0"
2
+ VERSION = "1.0.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scoped_attr_accessor
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -111,7 +111,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
111
111
  version: '0'
112
112
  segments:
113
113
  - 0
114
- hash: 4018385502197385766
114
+ hash: -2597970377507506024
115
115
  required_rubygems_version: !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  segments:
122
122
  - 0
123
- hash: 4018385502197385766
123
+ hash: -2597970377507506024
124
124
  requirements: []
125
125
  rubyforge_project:
126
126
  rubygems_version: 1.8.25