Class: Resolvable::OpenStructShim

Inherits:
OpenStruct
  • Object
show all
Includes:
Resolvable
Defined in:
lib/resolvable/open_struct_shim.rb

Constant Summary

Constants included from Resolvable

VERSION

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resolvable

#errors, #failure!, #failure?, included, #success!, #success?

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/resolvable/open_struct_shim.rb', line 12

def method_missing(method_name, *args)
  file, line, method_info = caller(1, 1)[0].split(":")

  kernel.warn "Missing method called on OpenStructShim: #{method_name} is not defined on #{self.class.name} (Called from #{file}##{line} in #{method_info}"

  super
end

Instance Attribute Details

#kernelObject



20
21
22
# File 'lib/resolvable/open_struct_shim.rb', line 20

def kernel
  @kernel ||= Kernel
end

Class Method Details

.default_failure_messageObject



6
7
8
# File 'lib/resolvable/open_struct_shim.rb', line 6

def self.default_failure_message
  "Failed to resolve #{self.name}"
end