Class: Kerbi::Cli::ReleaseSerializer

Inherits:
BaseSerializer show all
Defined in:
lib/cli/release_serializer.rb

Instance Attribute Summary

Attributes inherited from BaseSerializer

#context, #object, #parent_object

Instance Method Summary collapse

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

#backendObject



17
18
19
# File 'lib/cli/release_serializer.rb', line 17

def backend
  object.class.type_signature
end

#broken_txtObject



41
42
43
# File 'lib/cli/release_serializer.rb', line 41

def broken_txt
  "ERR"
end

#latestObject



33
34
35
36
37
38
39
# File 'lib/cli/release_serializer.rb', line 33

def latest
  if object.working?
    object.entry_set.latest&.tag
  else
    broken_txt
  end
end

#nameObject



13
14
15
# File 'lib/cli/release_serializer.rb', line 13

def name
  object.release_name
end

#resourceObject



21
22
23
# File 'lib/cli/release_serializer.rb', line 21

def resource
  object.resource_name
end

#statesObject



25
26
27
28
29
30
31
# File 'lib/cli/release_serializer.rb', line 25

def states
  if object.working?
    object.entries.count
  else
    broken_txt
  end
end