lib/bookmark/base.rb
# not sure this should work unless we are folder backed
not sure this should work unless we are folder backed
not sure this should work unless we are folder backed
def to_s(parent: nil, child: nil)
      if source.input.instance_of?(Pathname)
        if @hosting_section&.source&.input&.dirname == source.input.dirname
          parent ||= 0
          child ||= 0
        elsif @hosting_section
          parent ||= @hosting_section.source.input.dirname.ascend.to_a.index { |i| i.to_s == source.input.dirname.to_s }
          child ||= source.input.dirname.ascend.to_a.index { |i| i.to_s == @hosting_section.source.input.dirname.to_s }
          parent ||= 0
          child ||= 0
        end
        input_str =
          if parent.nil?
            input
          elsif parent.zero?
            input.split("/").last
          else
            ("../" * parent) + input.gsub(/\.\.\//, "").split("/").last
          end
        if child && !child.zero?
          input_str =
            input.to_s.reverse.split("/")[1..child]
              .map(&:reverse).reverse.join("/") + "/" + input_str.split("/").last
        end
        input_str = input_str.sub(/\.rbp$/, "")
      end
      input_str ||= input
      options = @options.map { |k, v| "-#{k} #{v}" }.join(" ")
      [@command, input_str, options].join(" ").strip
    end
def to_s ( parent : nil , child : nil ) if source . input . instance_of? ( Pathname ) if @hosting_section &. source &. input &. dirname == source . input . dirname parent ||= 0 child ||= 0 elsif @hosting_section parent ||= @hosting_section . source . input . dirname . ascend . to_a . index { | i | i . to_s == source . input . dirname . to_s } child ||= source . input . dirname . ascend . to_a . index { | i | i . to_s == @hosting_section . source . input . dirname . to_s } parent ||= 0 child ||= 0 end input_str = if parent . nil? input elsif parent . zero? input . split ( "/" ) . last else ( "../" * parent ) + input . gsub ( / \. \. \/ / , "" ) . split ( "/" ) . last end if child && ! child . zero? input_str = input . to_s . reverse . split ( "/" ) [ 1 .. child ] . map ( & :reverse ) . reverse . join ( "/" ) + "/" + input_str . split ( "/" ) . last end input_str = input_str . sub ( / \. rbp$ / , "" ) end input_str ||= input options = @options . map { | k , v | "-#{k} #{v}" } . join ( " " ) [ @command , input_str , options ] . join ( " " ) . strip end
not sure this should work unless we are folder backed
not sure this should work unless we are folder backed
# puts "#{child} #{parent} #{output}"
parent
<not_specific>
child
<not_specific>