summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@mimecast.com>2018-05-27 12:51:18 +0100
committerPaul Buetow <paul@mimecast.com>2018-05-27 12:51:18 +0100
commitc3b6deb8ab336380b71a07ff6e07eacab4e34888 (patch)
tree4fc53d419d7b64150b6f5e3ca7d4e8baf65cd2a5
parent121899b7a3bcdd8249a122740086cd5108857342 (diff)
add binary support
-rw-r--r--geheim.rb13
1 files 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