erikw/nestedtext-ruby

View on GitHub
lib/nestedtext/encode_helpers.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
# frozen_string_literal: true

require 'nestedtext/dumper'

module NestedText
  # A mixin for Custom Classes to get the to_nt shortcut.
  module ToNTMixin
    # Encode this object to a NestedText string.
    #
    # This method takes the same named arguments as {NestedText.dump}.
    def to_nt(**kwargs)
      NestedText.dump(self, strict: false, **kwargs)
    end
  end
end