Module: Micro::Attributes::Features::Accept::Validate::Predicate
- Defined in:
- lib/micro/attributes/features/accept.rb
Constant Summary collapse
- QUESTION_MARK =
'?'.freeze
Class Method Summary collapse
- .accept_failed(exp) ⇒ Object
- .call(exp, val) ⇒ Object
- .call?(exp) ⇒ Boolean
- .reject_failed(exp) ⇒ Object
Class Method Details
.accept_failed(exp) ⇒ Object
104 |
# File 'lib/micro/attributes/features/accept.rb', line 104 def self.accept_failed(exp); "expected to be #{exp}"; end |
.call(exp, val) ⇒ Object
103 |
# File 'lib/micro/attributes/features/accept.rb', line 103 def self.call(exp, val); val.public_send(exp); end |
.call?(exp) ⇒ Boolean
102 |
# File 'lib/micro/attributes/features/accept.rb', line 102 def self.call?(exp); exp.is_a?(Symbol) && exp.to_s.end_with?(QUESTION_MARK); end |
.reject_failed(exp) ⇒ Object
105 |
# File 'lib/micro/attributes/features/accept.rb', line 105 def self.reject_failed(exp); "expected to not be #{exp}"; end |