Class: I8::Struct::Hash
- Inherits:
-
Hash
- Object
- Hamster::Hash
- Hash
- I8::Struct::Hash
- Includes:
- I8::Struct, NRSER::Props::Immutable::Hash
- Defined in:
- lib/nrser/labs/i8.rb
Constant Summary
Constants included from NRSER::Props::Immutable::Hash
NRSER::Props::Immutable::Hash::STORAGE
Class Method Summary collapse
Methods included from NRSER::Props::Immutable::Hash
Methods inherited from Hamster::Hash
#as_json, #to_mutable, #to_yaml
Methods included from NRSER::Ext::Tree
#each_branch, #leaves, #map_branches, #map_leaves, #map_tree
Class Method Details
.define(**prop_defs, &body) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 118 119 |
# File 'lib/nrser/labs/i8.rb', line 107 def self.define **prop_defs, &body Class.new( I8::Struct::Hash ) do prop_defs.each do |name, settings| kwds = t.match settings, t.type, ->( type ) {{ type: type }}, t.hash_, settings prop name, **kwds end class_exec &body if body end end |
.new(*args, **kwds, &block) ⇒ Object
121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/nrser/labs/i8.rb', line 121 def self.new *args, **kwds, &block if self == I8::Struct::Hash define *args, **kwds, &block else # See NOTE in {I8::Struct::Vector.new} if kwds.empty? super( *args, &block ) else super( *args, **kwds, &block ) end end end |