Sha256: 3f2152be15cb1e59fbbd112da9f29b9b074bc13bbe1e6d61df63f06955bd71f6
Contents?: true
Size: 1.09 KB
Versions: 4
Compression:
Stored size: 1.09 KB
Contents
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
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
compo-0.3.1 | lib/compo/null_composite.rb |
compo-0.3.0 | lib/compo/null_composite.rb |
compo-0.2.0 | lib/compo/null_composite.rb |
compo-0.1.5 | lib/compo/null_composite.rb |