module Rum::Docker::AttrCallable
Mixin to enable adding instance methods to a class that gets or sets-and-returns the given attr of the instance.
Public Instance Methods
attr_method_accessor(*args)
click to toggle source
Method to define a method-accessor for each argument supplied. When extended by a class
Example:
class Fizz extend AttrCallable attr_method_accessor :buzz end fizz = Fizz.new fizz.buzz "foo" fizz.buzz # => "foo"
# File lib/rumrunner/docker.rb, line 30 def attr_method_accessor(*args) args.each do |var| define_method var do |value = nil| if value.nil? instance_variable_get :"@#{var}" else instance_variable_set :"@#{var}", value self end end end end