Class: Judges::Accumulator

Inherits:
Object show all
Defined in:
lib/judges/fb/if_absent.rb

Overview

Predents to be a fact, just accumulating all attribute sets.

Author

Yegor Bugayenko (yegor256@gmail.com)

Copyright

Copyright © 2024 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(map) ⇒ Accumulator

Returns a new instance of Accumulator.



52
53
54
# File 'lib/judges/fb/if_absent.rb', line 52

def initialize(map)
  @map = map
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



56
57
58
59
60
61
62
63
# File 'lib/judges/fb/if_absent.rb', line 56

def method_missing(*args)
  k = args[0]
  if k.end_with?('=')
    @map[k[0..-2].to_sym] = args[1]
  else
    @map[k.to_sym]
  end
end

Instance Method Details

#respond_to?(_method, _include_private = false) ⇒ Boolean

rubocop:disable Style/OptionalBooleanParameter

Returns:

  • (Boolean)


66
67
68
69
# File 'lib/judges/fb/if_absent.rb', line 66

def respond_to?(_method, _include_private = false)
  # rubocop:enable Style/OptionalBooleanParameter
  true
end

#respond_to_missing?(_method, _include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


71
72
73
# File 'lib/judges/fb/if_absent.rb', line 71

def respond_to_missing?(_method, _include_private = false)
  true
end