Class: Kerbi::Cli::EntryRowSerializer

Inherits:
BaseSerializer show all
Includes:
EntrySerializationHelpers
Defined in:
lib/cli/entry_serializers.rb

Instance Attribute Summary

Attributes inherited from BaseSerializer

#context, #object, #parent_object

Instance Method Summary collapse

Methods included from EntrySerializationHelpers

#colored_tag, #defined_or_na

Methods inherited from BaseSerializer

associations, #attribute_value, attributes, has_attributes, has_many, has_one, header_titles, #initialize, #key, #limit_has_many, possessions, #serialize, serialize, #serialize_associations, #serialize_flat_attrs, serialize_many, #serialize_possessions, #serialized_relation_value

Constructor Details

This class inherits a constructor from Kerbi::Cli::BaseSerializer

Instance Method Details

#assignmentsObject



78
79
80
81
82
# File 'lib/cli/entry_serializers.rb', line 78

def assignments
  defined_or_na(object.values) do |values|
    Kerbi::Utils::Misc.flatten_hash(values).count
  end
end

#created_atObject



90
91
92
93
94
95
96
# File 'lib/cli/entry_serializers.rb', line 90

def created_at
  if object.created_at
    Kerbi::Utils::Misc.pretty_time_elapsed(object.created_at)
  else
    "N/A"
  end
end

#messageObject



74
75
76
# File 'lib/cli/entry_serializers.rb', line 74

def message
  (object.message || "").truncate(27)
end

#overridesObject



84
85
86
87
88
# File 'lib/cli/entry_serializers.rb', line 84

def overrides
  defined_or_na(object.overrides_delta) do |differences|
    Kerbi::Utils::Misc.flatten_hash(differences).count
  end
end

#tagObject



70
71
72
# File 'lib/cli/entry_serializers.rb', line 70

def tag
  colored_tag
end