From c3b6deb8ab336380b71a07ff6e07eacab4e34888 Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sun, 27 May 2018 12:51:18 +0100 Subject: add binary support --- geheim.rb | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/geheim.rb b/geheim.rb index 25eb5c2..4a03f82 100644 --- a/geheim.rb +++ b/geheim.rb @@ -126,12 +126,21 @@ class Index < CommitFile end end + def is_binary? + if @description.include?(".txt") + false + else + @description.include?(".") + end + end + def get_data(data: nil) GeheimData.new(data_file: @data_file, data: data) end def to_s - "=> #{@description} <= ...#{@hash[-11...-1]}\n" + binary = is_binary? ? "(BINARY) " : "" + "=> #{@description} #{binary}<= ...#{@hash[-11...-1]}\n" end def <=>(other) @@ -165,7 +174,7 @@ class Geheim < Config end indexes.sort.each do |index| print index - print index.get_data if show + print index.get_data if show and !index.is_binary? end end -- cgit v1.2.3