class YamlNormalizer::Services::Base
The Base
Service provides a convenience class method “call” to initialize the Service with the given arguments and call the method “call” on the instance. @example
class ReverseService < Base def initialize(str) @str = str.to_s end def call @str.reverse end end
Public Class Methods
call(*args)
click to toggle source
new(*args)
click to toggle source
Creates a service object. Inherit from Base
and implement this method. @example
class IsFile < Base attr_reader :file def initialize(file) @file = file.to_s end def call File.file? file end end
@param *args [Array<Object>] arguments @raise [NotImplementedError] if call is not implemented
# File lib/yaml_normalizer/services/base.rb, line 34 def initialize(*args) @args = args end
Public Instance Methods
call()
click to toggle source
Inherit from Base
and implement the call method @raise [NotImplementedError] if call is not implemented
# File lib/yaml_normalizer/services/base.rb, line 47 def call raise NotImplementedError end