class Object
Public Instance Methods
help_io()
click to toggle source
# File lib/kv.rb, line 881 def help_io readme = File.read(File.join(__dir__, '../README.md')) help = [] readme.each_line{|line| if /kv: A pager by Ruby Command list/ =~ line help << line elsif /^```/ =~ line && !help.empty? break elsif !help.empty? help << line end } help_io = StringIO.new(help.join) end
log(obj, prefix = '')
click to toggle source
# File lib/kv.rb, line 859 def log obj, prefix = '' if $debug_log File.open($debug_log, 'a'){|f| f.puts "#{$$} #{prefix}#{obj.inspect}" } end end
partition(str, search)
click to toggle source
# File lib/kv.rb, line 867 def partition str, search results = [] loop{ r = str.match(search){|m| break if m.post_match == str results << [:unmatch, m.pre_match] results << [:match, m.to_s] str = m.post_match } break unless r } results << [:unmatch, str] end