Skip to content
Easily load hashes into objects automatically! The implementation is cleaner than the original hashie/mhash as no method_missng/class_eval is used.
Ruby
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.
lib
spec
.gitignore
Readme.md
blizz.gemspec

Readme.md

Blizz

[ruby]

Blizz let's you easily load hashes into objects, adding accessors, without modifying too much your base class

class Example
  include Blizz::Resource
  
  def foo
    "bar"
  end
end

hash = { a: "b", c: "d" }

example = Blizz.load Example, hash
p example.a # => "b"
p example.c # => "d"
p example.foo # => "bar"
p example.class # => Example

Simple isn't it?

Useful for prototyping domain models, DDD, etc :)

more...

load array of hases

load arrays of hashes, give them a :type and watch how Blizz casts them to classes!

partial loading

load only some properties of the hash in to the classs selectively

example:

example = Blizz.load Example, hash, [:a]

will load a: "b" but not c: "d"

have fun! @makevoid

You can’t perform that action at this time.