Class: MediaTypes::Scheme::OutputEmptyGuard
- Inherits:
-
Object
- Object
- MediaTypes::Scheme::OutputEmptyGuard
- Defined in:
- lib/media_types/scheme/output_empty_guard.rb
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(output, options, rules:) ⇒ OutputEmptyGuard
constructor
A new instance of OutputEmptyGuard.
Constructor Details
#initialize(output, options, rules:) ⇒ OutputEmptyGuard
Returns a new instance of OutputEmptyGuard.
15 16 17 18 19 |
# File 'lib/media_types/scheme/output_empty_guard.rb', line 15 def initialize(output, , rules:) self.output = output self. = self.rules = rules end |
Class Method Details
.call(*args, **opts, &block) ⇒ Object
10 11 12 |
# File 'lib/media_types/scheme/output_empty_guard.rb', line 10 def call(*args, **opts, &block) new(*args, **opts).call(&block) end |
Instance Method Details
#call ⇒ Object
21 22 23 24 25 |
# File 'lib/media_types/scheme/output_empty_guard.rb', line 21 def call return unless MediaTypes::Object.new(output).empty? throw(:end, true) if allow_empty? raise_empty!(backtrace: .backtrace, found: .scoped_output) end |