module DirectchatMircParse
DirectchatMircParse — shared mIRC .ibis script parsing helpers for directchat tooling. Public: popup_item_line?, safe_read Depends: (none) Tests: test/lib/directchat_mirc_parse_test.rb
Public Instance Methods
Source
# File lib/directchat/mirc_parse.rb, line 11 def popup_item_line?(line) stripped = line.strip return false if stripped.empty? return false if stripped.start_with?(";") return false if stripped.start_with?("-") return false if stripped.start_with?("$menuHeading") return false if stripped.start_with?("$style") stripped.match?(/\A\.[^:]+\s*:/) end
Source
# File lib/directchat/mirc_parse.rb, line 22 def safe_read(path) raw = File.binread(path) raw.force_encoding(Encoding::UTF_8) raw.valid_encoding? ? raw : raw.encode(Encoding::UTF_8, invalid: :replace, undef: :replace) rescue StandardError "" end