Class: Strum::ObjectToHash

Inherits:
Object
  • Object
show all
Includes:
Service
Defined in:
lib/strum/object_to_hash.rb

Instance Method Summary collapse

Methods included from Service

#errors, #execute, #failure, #hook, included, #initialize, #method_missing, #on, #respond_to_missing?, #success, #valid?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Strum::Service

Instance Method Details

#auditObject



14
15
16
# File 'lib/strum/object_to_hash.rb', line 14

def audit
  add_error(:input, :must_be_class) unless input.is_a?(Class)
end

#callObject



9
10
11
12
# File 'lib/strum/object_to_hash.rb', line 9

def call
  key = input.methods.include?(:name) ? input.name : input.class.name
  output(key => input)
end