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.



42
43
44
# File 'lib/judges/fb/if_absent.rb', line 42

def initialize(map)
  @map = map
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(*args) ⇒ Object



46
47
48
49
50
# File 'lib/judges/fb/if_absent.rb', line 46

def method_missing(*args)
  k = args[0]
  raise "Unexpected interation with the fact: '#{k}'" unless k.end_with?('=')
  @map[k[0..-2]] = args[1]
end

Instance Method Details

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

rubocop:disable Style/OptionalBooleanParameter

Returns:

  • (Boolean)


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

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

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

Returns:

  • (Boolean)


58
59
60
# File 'lib/judges/fb/if_absent.rb', line 58

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