Module: PrivateAttr
- Defined in:
- lib/private_attr.rb,
lib/private_attr/version.rb
Constant Summary collapse
- VERSION =
"2.0.0"
Class Method Summary collapse
- .private_alias_method(new_name, old_name) ⇒ Object
- .private_attr_accessor(*attr) ⇒ Object
- .private_attr_reader(*attr) ⇒ Object
- .private_attr_writer(*attr) ⇒ Object
- .protected_alias_method(new_name, old_name) ⇒ Object
- .protected_attr_accessor(*attr) ⇒ Object
- .protected_attr_reader(*attr) ⇒ Object
- .protected_attr_writer(*attr) ⇒ Object
Class Method Details
.private_alias_method(new_name, old_name) ⇒ Object
38 39 40 41 |
# File 'lib/private_attr.rb', line 38 def private_alias_method(new_name, old_name) alias_method(new_name, old_name) private(new_name) end |
.private_attr_accessor(*attr) ⇒ Object
8 9 10 11 |
# File 'lib/private_attr.rb', line 8 def private_attr_accessor(*attr) private_attr_reader(*attr) private_attr_writer(*attr) end |
.private_attr_reader(*attr) ⇒ Object
13 14 15 16 |
# File 'lib/private_attr.rb', line 13 def private_attr_reader(*attr) attr_reader(*attr) private(*attr) end |
.private_attr_writer(*attr) ⇒ Object
18 19 20 21 |
# File 'lib/private_attr.rb', line 18 def private_attr_writer(*attr) attr_writer(*attr) private(*attr.map { |a| "#{a}=" }) end |
.protected_alias_method(new_name, old_name) ⇒ Object
43 44 45 46 |
# File 'lib/private_attr.rb', line 43 def protected_alias_method(new_name, old_name) alias_method(new_name, old_name) protected(new_name) end |
.protected_attr_accessor(*attr) ⇒ Object
23 24 25 26 |
# File 'lib/private_attr.rb', line 23 def protected_attr_accessor(*attr) protected_attr_reader(*attr) protected_attr_writer(*attr) end |
.protected_attr_reader(*attr) ⇒ Object
28 29 30 31 |
# File 'lib/private_attr.rb', line 28 def protected_attr_reader(*attr) attr_reader(*attr) protected(*attr) end |
.protected_attr_writer(*attr) ⇒ Object
33 34 35 36 |
# File 'lib/private_attr.rb', line 33 def protected_attr_writer(*attr) attr_writer(*attr) protected(*attr.map { |a| "#{a}=" }) end |