Adds the ability to quickly model classes. Definitions of instance variables and access methods are reduced to one line. Creating an instance of the modeled class is significantly slower (~20x), so its use for classes whose instances are created frequently is not recommended.
require 'modeling'
# with modeling:
class Foo
model :first, :@R_second
end
# without modeling:
class Foo
def initialize first, second
@first = first
@second = second
end
attr_accessor :first
attr_reader :second
end
gem install modeling
- Łukasz Pomietło ([email protected])