module Micro::Attributes::Utils::ExtractAttribute
Public Class Methods
call(object, key:)
click to toggle source
# File lib/micro/attributes/utils.rb, line 43 def self.call(object, key:) return object.public_send(key) if object.respond_to?(key) Hashes.assoc(object, key) if object.respond_to?(:[]) end
from(object, keys:)
click to toggle source
# File lib/micro/attributes/utils.rb, line 49 def self.from(object, keys:) Kind::Array[keys].each_with_object({}) do |key, memo| memo[key] = call(object, key: key) end end