0.0
No commit activity in last 3 years
No release in over 3 years
Auto attribute initialization.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
>= 0

Runtime

 Project Readme
LICENSE: Public Domain
AUTHOR: ne_Sachirou <utakata.c4se@gmail.com>
DATE: 2013-09-23

Install

gem install auto_attr_init

From RubyGems.org/auto_attr_init

AutoAttrInit

Dart and CoffeeScript like "automatic field initialization" in Ruby.

Dart has automatic field initialization.

class Point {
  num x, y;
  Point(this.x, this.y);
}

CoffeeScript has a same function.

class Point
  constructor: (@x, @y) ->

With this gem, you can do like this.

class Point
  def initialize x, y; end
  attr_reader :x, :y
  auto_attr_init
end

Or like this.

class Point
  def initialize @x, @y; end
  attr_reader :x, :y
end

cf. Idiomatic Dart | Dart: Structured web apps Dart's "automatic field initialization".

cf. CoffeeScript Classes, Inheritance, and Super CoffeeScript has same function.

cf. Dart風のautomatic field initializationをRubyで - c4se記:さっちゃんですよ☆ My blog entry.