Class: Fetching::FetchingHash

Inherits:
Fetching
  • Object
show all
Defined in:
lib/fetching/fetching_hash.rb

Constant Summary

Constants inherited from Fetching

VERSION, WHITELIST

Instance Method Summary collapse

Methods inherited from Fetching

#==, from, from_json, #hash, #inspect, #to_fetching, #to_s

Constructor Details

#initialize(*args) ⇒ FetchingHash

Returns a new instance of FetchingHash.



4
5
6
7
# File 'lib/fetching/fetching_hash.rb', line 4

def initialize(*args)
  super
  make_methods
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key, *_args, &_block) ⇒ Object (private)

Raises:

  • (NoMethodError)


23
24
25
# File 'lib/fetching/fetching_hash.rb', line 23

def method_missing(key, *_args, &_block)
  raise NoMethodError, "#{key} not found\nyou have:\n#{@table.keys.join(', ')}"
end

Instance Method Details

#to_hashObject



9
10
11
# File 'lib/fetching/fetching_hash.rb', line 9

def to_hash
  @table.dup
end