Sha256: a060c21e868d52fa6ac049244098fa2989f12e74362fd9e732443f6e08ac1fee

Contents?: true

Size: 886 Bytes

Versions: 9

Compression:

Stored size: 886 Bytes

Contents

# frozen_string_literal: true

class StringDoc
  # Lets two or more node's attributes to be manipulated together. Used by {StringDoc::MetaNode}.
  #
  # @api private
  class MetaAttributes
    def initialize(attributes)
      @attributes = attributes
    end

    def []=(key, value)
      @attributes.each do |attributes|
        attributes[key] = value
      end
    end

    def [](key)
      @attributes[0][key]
    end

    def delete(key)
      @attributes.each do |attributes|
        attributes.delete(key)
      end
    end

    def key?(key)
      @attributes.any? { |attributes|
        attributes.key?(key)
      }
    end

    def each(&block)
      @attributes.each do |attributes|
        attributes.each(&block)
      end
    end

    # @api private
    def wrap(&block)
      @attributes.each do |attributes|
        attributes.wrap(&block)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
pakyow-presenter-1.0.6 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.5 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.4 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.3 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.2 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.1 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.0 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.0.rc5 lib/string_doc/meta_attributes.rb
pakyow-presenter-1.0.0.rc4 lib/string_doc/meta_attributes.rb