Module: Dizby::ClassicAttributeAccess

Included in:
BasicServer, PolymorphicDelegated::ClassMethods
Defined in:
lib/dizby/utility/classic_access.rb

Instance Method Summary collapse

Instance Method Details

#attr_accessor(*args)


20
21
22
23
# File 'lib/dizby/utility/classic_access.rb', line 20

def attr_accessor(*args)
  attr_reader(*args)
  attr_writer(*args)
end

#attr_reader(*args)


4
5
6
7
8
9
10
# File 'lib/dizby/utility/classic_access.rb', line 4

def attr_reader(*args)
  args.each do |method|
    define_method(method) do
      instance_variable_get(:"@#{method}")
    end
  end
end

#attr_writer(*args)


12
13
14
15
16
17
18
# File 'lib/dizby/utility/classic_access.rb', line 12

def attr_writer(*args)
  args.each do |method|
    define_method("#{method}=") do |value|
      instance_variable_set(:"@#{method}", value)
    end
  end
end