Class: Module
- Inherits:
-
Object
- Object
- Module
- Defined in:
- lib/cinch/rubyext/module.rb
Overview
Extensions to Ruby’s Module class.
Instance Method Summary collapse
-
#synced_attr_accessor(attr) ⇒ Object
private
Like
attr_accessor
, but for defining a synchronized attribute accessor. -
#synced_attr_reader(attribute) ⇒ Object
private
Like
attr_reader
, but for defining a synchronized attribute reader.
Instance Method Details
#synced_attr_accessor(attr) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Like attr_accessor
, but for defining a synchronized attribute
accessor
22 23 24 25 |
# File 'lib/cinch/rubyext/module.rb', line 22 def synced_attr_accessor(attr) synced_attr_reader(attr) attr_accessor(attr) end |
#synced_attr_reader(attribute) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Like attr_reader
, but for defining a synchronized attribute
reader.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cinch/rubyext/module.rb', line 7 def synced_attr_reader(attribute) undef_method(attribute) define_method(attribute) do attr(attribute) end define_method("#{attribute}_unsynced") do attr(attribute, false, true) end end |