Module: Kind::Dig
Instance Method Summary collapse
- #[](*keys) ⇒ Object
- #call(data, *input) {|result| ... } ⇒ Object
-
#call!(data, keys = Empty::ARRAY) ⇒ Object
:nodoc.
- #presence(*args, &block) ⇒ Object
Instance Method Details
#[](*keys) ⇒ Object
35 36 37 |
# File 'lib/kind/dig.rb', line 35 def [](*keys) ->(data) { call!(data, keys) } end |
#call(data, *input) {|result| ... } ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/kind/dig.rb', line 21 def call(data, *input) args = input.size == 1 && input[0].kind_of?(::Array) ? input[0] : input result = call!(data, args) return result unless block_given? yield(result) unless KIND.nil_or_undefined?(result) end |