Class: Creed::Command
- Inherits:
-
Object
- Object
- Creed::Command
- Defined in:
- lib/creed/command.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.perform(*context, &block) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/creed/command.rb', line 9 def self.perform(*context, &block) # Make sure that any given options have their keys symbolized, otherwise they will be ignored, # as Dry::Initializer requires keyword arguments or symbolized keys. = context. unless .empty? .symbolize_keys! # Raise on unknown options. unknown_keys = .keys - dry_initializer..map(&:source) raise ArgumentError, "unknown keys: `#{unknown_keys.join '`, `'}`" if unknown_keys.any? end (.empty? ? new(*context) : new(*context, **)).perform(&block) end |
Instance Method Details
#perform ⇒ Object
25 26 27 |
# File 'lib/creed/command.rb', line 25 def perform raise NotImplementedError end |