Class: Predicate::Dsl
- Inherits:
-
Object
- Object
- Predicate::Dsl
- Defined in:
- lib/predicate/dsl.rb
Instance Method Summary collapse
-
#initialize(var = nil, allow_currying = true) ⇒ Dsl
constructor
A new instance of Dsl.
- #method_missing(n, *args, &bl) ⇒ Object
- #respond_to_missing?(n, include_private = false) ⇒ Boolean
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(n, *args, &bl) ⇒ Object
96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/predicate/dsl.rb', line 96 def method_missing(n, *args, &bl) snaked, to_negate = missing_method_pair(n) if snaked == n.to_s && !to_negate super elsif self.respond_to?(snaked) got = __send__(snaked.to_sym, *args, &bl) to_negate ? !got : got else super end end |
Instance Method Details
#respond_to_missing?(n, include_private = false) ⇒ Boolean
108 109 110 111 112 |
# File 'lib/predicate/dsl.rb', line 108 def respond_to_missing?(n, include_private = false) snaked, to_negate = missing_method_pair(n) return super if snaked == n.to_s self.respond_to?(snaked) end |