Skip to content
Struct will have default values for each member.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
lib/struct
test
.gitignore
.travis.yml
.yardopts
Gemfile
MIT-LICENSE
README.md
Rakefile
struct-default_value.gemspec

README.md

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.

You can’t perform that action at this time.