Class: FunctionalLightService::Organizer::VerifyCallMethodExists
- Defined in:
- lib/functional-light-service/organizer/verify_call_method_exists.rb
Overview
We need to make sure existing users will use `call` method name going forward. This should be removed eventually.
Class Method Summary collapse
Class Method Details
.caller_method(first_caller) ⇒ Object
22 23 24 25 26 |
# File 'lib/functional-light-service/organizer/verify_call_method_exists.rb', line 22 def self.caller_method(first_caller) return nil unless first_caller =~ /`(.*)'/ Regexp.last_match[1] end |
.run(klass, first_caller = '') ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/functional-light-service/organizer/verify_call_method_exists.rb', line 7 def self.run(klass, first_caller = '') invoker_method = caller_method(first_caller) return if invoker_method == 'call' call_method_exists = klass.methods.include?(:call) return if call_method_exists warning_msg = "DEPRECATION WARNING:" \ "The <#{klass.name}> class is an organizer, " \ "its entry method (the one that calls with & reduce) " \ "should be named `call`. " \ "Please use #{klass}.call going forward." print warning_msg end |