Class: IsccLib::Result

Inherits:
Hash
  • Object
show all
Defined in:
lib/iscc_lib.rb

Overview

Base result class providing both Hash-style and attribute-style access.

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object

Allow attribute-style access for hash keys (e.g., result.iscc).



23
24
25
26
27
28
# File 'lib/iscc_lib.rb', line 23

def method_missing(name, *args)
  key = name.to_s
  return self[key] if key?(key)

  super
end

Instance Method Details

#respond_to_missing?(name, include_private = false) ⇒ Boolean

Support respond_to? for dynamic attribute access.

Returns:

  • (Boolean)


31
32
33
# File 'lib/iscc_lib.rb', line 31

def respond_to_missing?(name, include_private = false)
  key?(name.to_s) || super
end