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



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

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

#created_atObject



97
98
99
100
101
102
103
# File 'lib/cli/entry_serializers.rb', line 97

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

#messageObject



81
82
83
# File 'lib/cli/entry_serializers.rb', line 81

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

#overridesObject



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

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

#tagObject



77
78
79
# File 'lib/cli/entry_serializers.rb', line 77

def tag
  colored_tag
end