Method: Module#synced_attr_reader

Defined in:
lib/cinch/rubyext/module.rb

#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