Sha256: a07362b099de80ab19149bc2fee0b32961f75fbf554dfa5e69f014f8027d61f0
Contents?: true
Size: 751 Bytes
Versions: 11
Compression:
Stored size: 751 Bytes
Contents
module SimpleService class ValidatesCommandsProperlyInherit < Command expects :provided_commands skip_validation true # prevent infinite loop def call # valid commands inherit from Command and do not inherit from service # reject all valid commands and anything left over is invalid invalid_commands = provided_commands.to_a.reject do |command| command.ancestors.include?(SimpleService::Command) || command.ancestors.include?(SimpleService::Organizer) end if invalid_commands.any? error_msg = invalid_commands.join(', ') + ' - must inherit from SimpleService::Command' raise SimpleService::CommandParentClassInvalidError, error_msg end end end end
Version data entries
11 entries across 11 versions & 1 rubygems