module SuperStruct
Constants
- VERSION
Public Class Methods
from_hash(hash, &block)
click to toggle source
# File lib/super_struct.rb, line 51 def self.from_hash(hash, &block) new(hash, &block).new(hash) end
new(*input, &block)
click to toggle source
# File lib/super_struct.rb, line 39 def self.new(*input, &block) keys = if input.first.respond_to?(:has_key?) input.first.keys.sort.map(&:to_sym) else input.sort.map(&:to_sym) end Struct.new(*keys, &block).tap do |struct| struct.send(:include, ::SuperStruct::InstanceMethods) end end