Sha256: 7a19a9056722bd427fb6370510bb3adc5268cf5c7386f2824b866cfd7b490736
Contents?: true
Size: 727 Bytes
Versions: 2
Compression:
Stored size: 727 Bytes
Contents
module SimpleService class ValidatesCommandsProperlyInherit < Command expects :provided_commands skip_validation true 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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
simple_service-1.2.6 | lib/simple_service/commands/validates_commands_properly_inherit.rb |
simple_service-1.2.5 | lib/simple_service/commands/validates_commands_properly_inherit.rb |