Sha256: 9e8fbda4b2c698a8dfa3c21de67586637677f1b07436ffe1b935c2319ee6a839
Contents?: true
Size: 1.12 KB
Versions: 5
Compression:
Stored size: 1.12 KB
Contents
require 'forwardable' require 'compo/composite' module Compo # Null implementation of Composite # # Add/remove operations on NullComposite always fail, and #children always # returns the empty hash. # # This is useful for leaf classes that still need to expose the composite # API. class NullComposite include Composite # Returns the empty hash # # @api public # @example Gets the children # comp.children # #=> {} # # @return [Hash] The empty hash. def children {} end private # Fails to add a child into the NullComposite # # @api private # # @param id [Object] Ignored. # @param child [Object] Ignored. # # @return [nil] def add!(_, _) nil end # Fails to remove the given child # # @api private # # @param child [Object] Ignored. # # @return [nil] def remove!(_) nil end # Fails to remove the child with the given ID # # @api private # # @param id [Object] Ignored. # # @return [nil] def remove_id!(_) nil end end end
Version data entries
5 entries across 5 versions & 1 rubygems