Module: Kerbi::Cli::EntrySerializationHelpers

Included in:
EntryRowSerializer, EntryYamlJsonSerializer, FullEntryRowSerializer
Defined in:
lib/cli/entry_serializers.rb

Instance Method Summary collapse

Instance Method Details

#colored_tagObject



20
21
22
23
24
# File 'lib/cli/entry_serializers.rb', line 20

def colored_tag
  #noinspection RubyResolve
  color = object.committed? ? :blue : :yellow
  object.tag.colorize(color)
end

#defined_or_na(actual_value) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/cli/entry_serializers.rb', line 4

def defined_or_na(actual_value)
  if !(value = actual_value).nil?
    if block_given?
      begin
        yield(value)
      rescue
        "ERR"
      end
    else
      value
    end
  else
    "N/A"
  end
end