Categories: None [Edit]
better-initialize
# better-initialize
A friendlier, dependency-free initialize method for ruby objects.
## Usage
Gemfile:
gem 'better-initialize',
github: 'huned/better-initialize'
Code:
require 'better_initialize'
class Pizza
include BetterInitialize
attr_accessor :size, :toppings
end
# Instantiate with attributes.
Pizza.new(size: :large, toppings: %i[mushrooms peppers])
# Instantiate with attributes and a block.
Pizza.new(size: :large) do |pizza|
pizza.toppings = %w[mushrooms peppers]
Oven.bake!(pizza)
end
## Development Environment (OSX)
brew install rbenv ruby-build
git clone [email protected]:huned/better-initialize
rbenv install -k `cat .ruby-version`
bundle exec ruby test/run.rb
Total
Ranking: 142,688 of 183,477
Downloads: 3,704
Daily
Ranking: 63,432 of 183,470
Downloads: 0
Downloads Trends
Ranking Trends
Num of Versions Trends
Popular Versions (Major)
Popular Versions (Major.Minor)
Depended by
Rank | Downloads | Name |
---|
Owners
# | Gravatar | Handle |
---|---|---|
1 | huned4real |