Sha256: 9163628b030328735463d206c5fea36324989c99af76a6cf0f65988ca325771b
Contents?: true
Size: 306 Bytes
Versions: 4
Compression:
Stored size: 306 Bytes
Contents
class Hash # Convert to Struct including all values that are Hash class. def to_struct keys = self.keys.sort members = keys.map(&:to_sym) Struct.new(*members).new(*keys.map do |key| (self[key].kind_of? Hash) ? self[key].to_struct : self[key] end) unless self.empty? end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
ginatra-4.1.0 | lib/git/webby/extensions.rb |
ginatra-4.0.2 | lib/git/webby/extensions.rb |
ginatra-4.0.1 | lib/git/webby/extensions.rb |
ginatra-4.0.0 | lib/git/webby/extensions.rb |