Sha256: fcfa3d3a61f93a14b8df3b28b481470beb38a1da6048e779486052e57e7950ee
Contents?: true
Size: 879 Bytes
Versions: 253
Compression:
Stored size: 879 Bytes
Contents
module Actions module Helpers # Delegate task information to presenter object module Presenter def presenter fail NotImplementedError end delegate :humanized_output, to: :presenter class Base include Algebrick::TypeCheck attr_reader :action def initialize(action) @action = action end def humanized_output fail NotImplementedError end end # Use sub-actions for presenting the data of the task class Delegated < Base def initialize(_action, delegated_actions) (Type! delegated_actions, Array).all? { |a| Type! a, Presenter } @delegated_actions = delegated_actions end def humanized_output @delegated_actions.map(&:humanized_output).compact.join("\n") end end end end end
Version data entries
253 entries across 253 versions & 1 rubygems