No commit activity in last 3 years
No release in over 3 years
include AutoInitializer to automatically assign all arguments provided to constructor as instance variables. setter and getter methods are still defined explicitly.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

 Project Readme

AutoInitializer

gem install auto_initializer
require 'auto_initializer'
class Test
  attr_reader :foo
  include AutoInitializer
end

(Test.new foo: :ok).foo
# => :ok

In simple english:

If you were going to write an initializer for the sole purpose of passing arguments to instance varaibles, there's no need. With this gem, you can have this happen automatically (the initializer will accept any keyword arguments passed). You still need to write attr_reader, attr_writer, etc. to read the data unless you use instance_variable_get.