Sha256: 45eaf1f1b39c4c4df68851a6388f86235f64e380cd45a2674365bac18e828d23
Contents?: true
Size: 680 Bytes
Versions: 13
Compression:
Stored size: 680 Bytes
Contents
# frozen_string_literal: true module Milestoner module Syndication # Provides shared functionality for refinements. module Shared def merge(**attributes) = attributes.each { |key, value| public_send :"#{key}=", value } def build_for(collection, **) collection.each { |attributes| build(**attributes.transform_keys(**)) } end def build(**attributes) node = public_send :"new_#{kind}" attributes.each { |key, value| node.public_send :"#{key}=", value } end private def kind self.class.name.downcase.split("::").last.sub("categories", "category").delete_suffix("s") end end end end
Version data entries
13 entries across 13 versions & 1 rubygems