No release in over 3 years
Low commit activity in last 3 years
Hyper lazy way of setting instance variables automatically by passing them to your constructor. Least clever gem ever?
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

 Project Readme

Allows you to set instance variables through constructor parameters. Dead simple but resolves an annoyance.

require 'settable_constructor_variables'

class MyClass
  include SettableConstructorVariables
  attr_accessor :something
end

MyClass.new(something: 'abc').something #=> 'abc'

To use this in conjunction with your own constructor…

class MyClass
  include SettableConstructorVariables
  attr_accessor :something

  def initialize params
    # do something
    super params
    # do something else
  end
end

Tinniest gem ever and having put the effort in to make it a gem, I am wondering how worthwhile the effort was…

… And now I wait for somebody to tell me it has already been done!