Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Tree: 07b50afdec
Fetching contributors…

Cannot retrieve contributors at this time

20 lines (19 sloc) 0.47 kB
module FunkyAccessor
def self.extended base
class << base
def funky_accessor *names
names.each do |name|
define_method(name) do |arg=nil, &block|
if block
instance_variable_set(:"@#{name}", block.call)
elsif arg
instance_variable_set(:"@#{name}", arg)
else
instance_variable_get(:"@#{name}")
end
end
end
end
end
end
end
Jump to Line
Something went wrong with that request. Please try again.