class GemLookup::Serializers::Interface

Public Class Methods

batch_iterator(num:, total:) click to toggle source

Should be overriden to output the current batch and total number of batches @param num [Numeric] the current batch number. @param total [Numeric] the total number of batches.

# File lib/gem_lookup/serializers/interface.rb, line 24
def batch_iterator(num:, total:)
  not_implemented __method__, params: %w[:num :total]
end
display(json:) click to toggle source

Should be overriden to output the desired output format for the gem @param json [Hash] the json hash, with symbolized keys.

# File lib/gem_lookup/serializers/interface.rb, line 11
def display(json:)
  not_implemented __method__, params: %w[:json]
end
gem_count(num:) click to toggle source

Should be overriden to output the number of gems being queried. @param num [Numeric] the number of gems.

# File lib/gem_lookup/serializers/interface.rb, line 17
def gem_count(num:)
  not_implemented __method__, params: %w[:num]
end
querying(batch:) click to toggle source

Should be overridden to output the list of gems being looked up from the batch. @param batch [Array] the array of gems.

# File lib/gem_lookup/serializers/interface.rb, line 30
def querying(batch:)
  not_implemented __method__, params: %w[:batch]
end
streaming?() click to toggle source

Should be overriden to return if the serializer is meant to be used to stream content. @return [Boolean] whether the serializer is meant for streaming content.

# File lib/gem_lookup/serializers/interface.rb, line 36
def streaming?
  not_implemented __method__
end

Private Class Methods

not_implemented(method, params: []) click to toggle source

rubocop:enable Lint/UnusedMethodArgument

# File lib/gem_lookup/serializers/interface.rb, line 43
def not_implemented(method, params: [])
  required = params.any? ? " with params (#{params.join(", ")})" : ''
  raise GemLookup::Errors::UndefinedInterfaceMethod,
        "Class method .#{method}#{required} must be implemented by sub-class"
end