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.
92 93 94 95 |
# File 'lib/factbase/rules.rb', line 92 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
101 102 103 104 105 106 |
# File 'lib/factbase/rules.rb', line 101 def method_missing(*args) r = @fact.method_missing(*args) k = args[0].to_s @check.it(@fact) if k.end_with?('=') r end |
Instance Method Details
#respond_to?(_method, _include_private = false) ⇒ Boolean
rubocop:disable Style/OptionalBooleanParameter
109 110 111 112 |
# File 'lib/factbase/rules.rb', line 109 def respond_to?(_method, _include_private = false) # rubocop:enable Style/OptionalBooleanParameter true end |
#respond_to_missing?(_method, _include_private = false) ⇒ Boolean
114 115 116 |
# File 'lib/factbase/rules.rb', line 114 def respond_to_missing?(_method, _include_private = false) true end |
#to_s ⇒ Object
97 98 99 |
# File 'lib/factbase/rules.rb', line 97 def to_s @fact.to_s end |