class Fetching::FetchingHash

Public Class Methods

new(*args) click to toggle source
Calls superclass method Fetching::new
# File lib/fetching/fetching_hash.rb, line 4
def initialize(*args)
  super
  make_methods
end

Public Instance Methods

to_hash() click to toggle source
# File lib/fetching/fetching_hash.rb, line 9
def to_hash
  @table.dup
end

Private Instance Methods

make_methods() click to toggle source
# File lib/fetching/fetching_hash.rb, line 15
def make_methods
  @table.each do |k, v|
    define_singleton_method(k) do
      Fetching.from(v)
    end
  end
end
method_missing(key, *_args, &_block) click to toggle source
# 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