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)


22
23
24
25
# File 'lib/dizby/utility/classic_access.rb', line 22

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

#attr_reader(*args)


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

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

#attr_writer(*args)


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

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