module ActiveJson::Pluck
Public Instance Methods
dig_attribute()
click to toggle source
# File lib/active_json/pluck.rb, line 12 def dig_attribute -> (hash, attribute) { hash.dig(attribute) if hash } end
new(pluck)
click to toggle source
# File lib/active_json/pluck.rb, line 5 def new(pluck) attributes = split_nested(pluck) -> (hash) do attributes ? attributes.reduce(hash, &dig_attribute) : hash end end
split_nested(pluck)
click to toggle source
# File lib/active_json/pluck.rb, line 16 def split_nested(pluck) return unless pluck pluck.split('.').map(&:to_sym) end