Skip to content

Commit

Permalink
Added empty lines after guard if-s according to rubocop rules
Browse files Browse the repository at this point in the history
  • Loading branch information
kimrgrey committed Sep 24, 2018
1 parent 0c9d714 commit 2088d6a
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/performify/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ def fail?
private def prepare_instance
define_singleton_method(:execute!) do |&block|
return if defined?(@result)

super(&block)
end

Expand Down
2 changes: 2 additions & 0 deletions lib/performify/callbacks.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ def register_callback(type_of_callback, method_name = nil, &block)
unless TYPES_OF_CALLBACK.include?(type_of_callback)
raise UnknownTypeOfCallbackError, "Type #{type_of_callback} is not allowed"
end

@service_callbacks ||= {}
@service_callbacks[type_of_callback] ||= []
@service_callbacks[type_of_callback] << method_name if method_name
Expand All @@ -23,6 +24,7 @@ def execute_callbacks(type_of_callback, instance)
unless TYPES_OF_CALLBACK.include?(type_of_callback)
raise UnknownTypeOfCallbackError, "Type #{type_of_callback} is not allowed"
end

cbs = (@service_callbacks || {}).fetch(type_of_callback, [])
cbs.each { |cb| cb.is_a?(Proc) ? instance.instance_eval(&cb) : instance.send(cb) }
nil
Expand Down
2 changes: 2 additions & 0 deletions lib/performify/validation.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ def schema

def validate
return args if schema.nil?

result = schema.with(with_options).call(args)
if result.success?
@inputs = result.output
Expand All @@ -37,6 +38,7 @@ def validate

def errors!(new_errors)
raise ArgumentError, 'Errors should be a hash' if new_errors.nil? || !new_errors.respond_to?(:to_h)

new_errors.to_h.each do |key, value|
errors[key] = errors.key?(key) ? [errors[key]].flatten(1) + [value].flatten(1) : value
end
Expand Down

0 comments on commit 2088d6a

Please sign in to comment.