Module: Disposable::Twin::Property::Hash

Defined in:
lib/disposable/twin/property/hash.rb

Overview

trailblazer.to/gems/disposable/api.html#hash

Defined Under Namespace

Modules: NestedDefaults, Sync

Class Method Summary collapse

Class Method Details

.included(includer) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/disposable/twin/property/hash.rb', line 7

def self.included(includer)
  # hash: true top-level properties need :default support.
  includer.feature Default

  # Recursively include Struct in :hash and nested properties.
  # defaults is applied to all ::property calls.
  includer.defaults do |name, options|
    if options[:field] == :hash
      hash_options
    else
      {}
    end
  end
end