lib/namer.rb in markdown_exec-2.3.0 vs lib/namer.rb in markdown_exec-2.4.0

- old
+ new

@@ -1,19 +1,20 @@ #!/usr/bin/env ruby # frozen_string_literal: true # encoding=utf-8 require 'digest' -# require_relative 'poly' $pd = false unless defined?($pd) class Hash # block name in commands and documents def pub_name(**kwargs) full = fetch(:nickname, nil) || fetch(:oname, nil) - full&.to_s&.pub_name(**kwargs).tap { |ret| pp [__LINE__, 'Hash.pub_name() ->', ret] if $pd } + full&.to_s&.pub_name(**kwargs).tap { |ret| + pp [__LINE__, 'Hash.pub_name() ->', ret] if $pd + } end end class String FN_ID_LEN = 4 @@ -34,17 +35,10 @@ self[0..max_len - id_len] + dig else self end - trimmed.gsub(pattern, replacement).tap { |ret| pp [__LINE__, 'String.pub_name() ->', ret] if $pd } + trimmed.gsub(pattern, replacement).tap { |ret| + pp [__LINE__, 'String.pub_name() ->', ret] if $pd + } end end - -# require 'ostruct' - -# class BlkS < OpenStruct -# # Method to fetch the value associated with the attribute :nickname or :oname -# def pub_name -# self.nickname || self.oname -# end -# end