Class: Factbase::Rules::Fact
- Inherits:
-
Object
- Object
- Factbase::Rules::Fact
- Defined in:
- lib/factbase/rules.rb
Overview
Fact decorator.
This is an internal class, it is not supposed to be instantiated directly.
Instance Method Summary collapse
-
#initialize(fact, check) ⇒ Fact
constructor
A new instance of Fact.
- #method_missing(*args) ⇒ Object
-
#respond_to?(_method, _include_private = false) ⇒ Boolean
rubocop:disable Style/OptionalBooleanParameter.
- #respond_to_missing?(_method, _include_private = false) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(fact, check) ⇒ Fact
Returns a new instance of Fact.
76 77 78 79 |
# File 'lib/factbase/rules.rb', line 76 def initialize(fact, check) @fact = fact @check = check end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(*args) ⇒ Object
85 86 87 88 89 90 |
# File 'lib/factbase/rules.rb', line 85 def method_missing(*args) r = @fact.method_missing(*args) k = args[0].to_s @check.it(self) if k.end_with?('=') r end |
Instance Method Details
#respond_to?(_method, _include_private = false) ⇒ Boolean
rubocop:disable Style/OptionalBooleanParameter
93 94 95 96 |
# File 'lib/factbase/rules.rb', line 93 def respond_to?(_method, _include_private = false) # rubocop:enable Style/OptionalBooleanParameter true end |
#respond_to_missing?(_method, _include_private = false) ⇒ Boolean
98 99 100 |
# File 'lib/factbase/rules.rb', line 98 def respond_to_missing?(_method, _include_private = false) true end |
#to_s ⇒ Object
81 82 83 |
# File 'lib/factbase/rules.rb', line 81 def to_s @fact.to_s end |