Class: Lite::Validation::Validator::Option::Some::Complex::Wrappers::Hash
- Inherits:
-
Abstract::Iterable
- Object
- Abstract::Iterable
- Lite::Validation::Validator::Option::Some::Complex::Wrappers::Hash
show all
- Includes:
- Singular
- Defined in:
- lib/lite/validation/validator/option/some/complex/wrappers/hash.rb
Instance Method Summary
collapse
Methods included from Singular
#some_or_nil, #to_option, #unwrap
Methods included from Dig
#dig
Instance Method Details
#fetch(key) ⇒ Object
16
17
18
19
20
|
# File 'lib/lite/validation/validator/option/some/complex/wrappers/hash.rb', line 16
def fetch(key)
return Option.none unless value.key? key
Option.some(value[key])
end
|
28
29
30
|
# File 'lib/lite/validation/validator/option/some/complex/wrappers/hash.rb', line 28
def inspect
"#<Option::Some::Hash length=#{value.length}>"
end
|
#reduce(initial_state, &block) ⇒ Object
22
23
24
25
26
|
# File 'lib/lite/validation/validator/option/some/complex/wrappers/hash.rb', line 22
def reduce(initial_state, &block)
value.lazy
.map { |key, value| [value, key] }
.reduce(initial_state, &block)
end
|