struct-default_value

Build Status Gem Version

Description

Struct will have default values for each member.

Usage

Overview

require 'struct/default_value'

class Foo < Struct.new :name, :birth_time
  default :name, '!BAR!'
  default(:birth_time) {Time.now}
end

foo = Foo.new
foo.name        #=> "!BAR!"
foo.birth_time  #=> time at generated

Requirements

Install

$ gem install struct-default_value

Link

License

The MIT X11 License
Copyright (c) 2012 Kenichi Kamiya
See MIT-LICENSE for further details.