Class: Toni::PermissionMatcher::NotMatcher
- Inherits:
-
Object
- Object
- Toni::PermissionMatcher::NotMatcher
- Defined in:
- lib/toni/permission_matcher.rb
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Instance Method Summary collapse
-
#initialize ⇒ NotMatcher
constructor
A new instance of NotMatcher.
- #matches?(object) ⇒ Boolean
- #method_missing(method_name, *args) ⇒ Object
Constructor Details
#initialize ⇒ NotMatcher
Returns a new instance of NotMatcher.
22 23 24 |
# File 'lib/toni/permission_matcher.rb', line 22 def initialize @matcher = nil end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args) ⇒ Object
26 27 28 29 30 31 32 33 |
# File 'lib/toni/permission_matcher.rb', line 26 def method_missing(method_name, *args) builder = Toni::Builder::ExpectationBuilder.new if builder.respond_to?(method_name) @matcher = builder.send(method_name, *args) else super end end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
20 21 22 |
# File 'lib/toni/permission_matcher.rb', line 20 def matcher @matcher end |
Instance Method Details
#matches?(object) ⇒ Boolean
35 36 37 38 |
# File 'lib/toni/permission_matcher.rb', line 35 def matches?(object) raise Toni::MissingMatcherError if @matcher.nil? !@matcher.matches?(object) end |