Sha256: d0d7b817d16c90e444f5a0feaf67a72b2c431638db3666e56ff8230765d5fbbe

Contents?: true

Size: 1.78 KB

Versions: 9

Compression:

Stored size: 1.78 KB

Contents

# frozen_string_literal: true

# @api private
# @since 0.19.0
class Qonfig::Plugins::PrettyPrint
  # @api private
  # @since 0.21.0
  module DataSetMixin
    # @param pp [?] Suitable for Ruby's PP module
    # @return [void]
    #
    # @api public
    # @since 0.19.0
    def pretty_print(pp)
      pp.object_address_group(self) do
        pp.seplist(keys, proc { pp.text(',') }) do |key|
          pp.breakable(' ')
          pp.group(1) do
            pp.text(key)
            pp.text(':')
            pp.breakable
            pp.pp(self[key])
          end
        end
      end
    end
  end

  # @api private
  # @since 0.21.0
  module CompactedConfigMixin
    # @param pp [?] Suitable for Ruby's PP module
    # @return [void]
    #
    # @api public
    # @since 0.21.0
    def pretty_print(pp)
      pp.object_address_group(self) do
        pp.seplist(@____data_set____.keys, ::Kernel.proc { pp.text(',') }) do |key|
          pp.breakable(' ')
          pp.group(1) do
            pp.text(key)
            pp.text(':')
            pp.breakable
            pp.pp(@____data_set____[key])
          end
        end
      end
    end

    # @return [Integer]
    #
    # @see Object#object_id
    # @see BasicObject#__id__
    #
    # @api public
    # @since 0.21.0
    alias_method :object_id, :__id__
  end

  # @api private
  # @since 0.21.0
  module SettingsMixin
    # @param pp [?] Suitable for Ruby's PP module
    # @return [void]
    #
    # @api public
    # @since 0.21.0
    def pretty_print(pp)
      pp.object_address_group(self) do
        pp.seplist(__keys__, proc { pp.text(',') }) do |key|
          pp.breakable(' ')
          pp.group(1) do
            pp.text(key)
            pp.text(':')
            pp.breakable
            pp.pp(self[key])
          end
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
qonfig-0.28.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.27.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.26.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.25.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.24.1 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.24.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.23.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.22.0 lib/qonfig/plugins/pretty_print/mixin.rb
qonfig-0.21.0 lib/qonfig/plugins/pretty_print/mixin.rb