Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/activeredis.rb

Instance Method Summary collapse

Instance Method Details

#module_attr_accessor(*syms) ⇒ Object



27
28
29
30
# File 'lib/activeredis.rb', line 27

def module_attr_accessor(*syms)
  module_attr_reader(*syms)
  module_attr_writer(*syms)
end

#module_attr_reader(*syms) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/activeredis.rb', line 8

def module_attr_reader(*syms)
  syms.each do |sym|
    class_eval(<<-EOS, __FILE__, __LINE__ + 1)
      @@#{sym} = nil unless defined?(@@#{sym})
      def self.#{sym}()
        return @@#{sym}
      end
    EOS
  end
end

#module_attr_writer(*syms) ⇒ Object



18
19
20
21
22
23
24
25
26
# File 'lib/activeredis.rb', line 18

def module_attr_writer(*syms)
  syms.each do |sym|
    class_eval(<<-EOS, __FILE__, __LINE__ + 1)
      def self.#{sym}=(obj)
        @@#{sym} = obj
      end
    EOS
  end
end