module SolidStruct
Allow structs to be initialised using a hash
Constants
- VERSION
Public Class Methods
build(hash)
click to toggle source
# File lib/solid_struct.rb, line 20 def self.build(hash) raise ArgumentError.new("Arguments must be defined as a hash") unless hash.is_a? Hash klass = NamedStruct.new(*hash.keys) klass.new(hash) end
new(*args)
click to toggle source
# File lib/solid_struct.rb, line 16 def self.new(*args) NamedStruct.new(*args) end