class KafoWizards::HighLine::StringOrFileRenderer

Public Instance Methods

render_action(entry) click to toggle source
# File lib/kafo_wizards/highline/string_or_file_renderer.rb, line 13
def render_action(entry)
  say entry.description if entry.description
  key = ask("file path or key")
  key = File.read(key) if File.exists?(key)
  entry.update(key.chomp)
  nil
end
render_value(entry) click to toggle source
# File lib/kafo_wizards/highline/string_or_file_renderer.rb, line 5
def render_value(entry)
  value = entry.value.to_s
  if value.length > 40
    value = entry.value[0..37]+'...'
  end
  "'#{::HighLine.color(value, :blue)}' (#{entry.value.to_s.length} bytes)"
end