Class: Judges::Accumulator
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
-
#initialize(map) ⇒ Accumulator
constructor
A new instance of Accumulator.
- #method_missing(*args) ⇒ Object
-
#respond_to?(_method, _include_private = false) ⇒ Boolean
rubocop:disable Style/OptionalBooleanParameter.
- #respond_to_missing?(_method, _include_private = false) ⇒ Boolean
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 |
# File 'lib/judges/fb/if_absent.rb', line 56 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
63 64 65 66 |
# File 'lib/judges/fb/if_absent.rb', line 63 def respond_to?(_method, _include_private = false) # rubocop:enable Style/OptionalBooleanParameter true end |
#respond_to_missing?(_method, _include_private = false) ⇒ Boolean
68 69 70 |
# File 'lib/judges/fb/if_absent.rb', line 68 def respond_to_missing?(_method, _include_private = false) true end |