Sha256: 2ecb69ba56f898ef86c13eb2b1a7b6def96fa54ae96043cf8c9e622b43c71b82
Contents?: true
Size: 644 Bytes
Versions: 2
Compression:
Stored size: 644 Bytes
Contents
require 'sham/nested' require 'sham/lazy' module Sham class Config class Base def object(klass) @klass = klass self end def sham(build = false) if build || !@klass.respond_to?(:create) @klass.new(*args) else @klass.create(*args) end end private def parse! value case value when Array then value.map{ |k| parse!(k) } when Hash then value.map{ |k,v| [k, parse!(v)] }.to_h when Sham::Nested then value.sham! when Sham::Lazy then value.sham! else value end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sham-2.0.0 | lib/sham/config/base.rb |
sham-1.2.0 | lib/sham/config/base.rb |