Class: Delorean::Ruby::Whitelists::Base
- Inherits:
-
Object
- Object
- Delorean::Ruby::Whitelists::Base
- Defined in:
- lib/delorean/ruby/whitelists/base.rb
Instance Attribute Summary collapse
-
#matchers ⇒ Object
readonly
Returns the value of attribute matchers.
Instance Method Summary collapse
Instance Attribute Details
#matchers ⇒ Object (readonly)
Returns the value of attribute matchers.
8 9 10 |
# File 'lib/delorean/ruby/whitelists/base.rb', line 8 def matchers @matchers end |
Instance Method Details
#add_method(method_name, match_to: nil, &block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/delorean/ruby/whitelists/base.rb', line 10 def add_method(method_name, match_to: nil, &block) return method_name_error unless method_name.is_a?(Symbol) return block_and_match_error if !match_to.nil? && block_given? return add_matched_method( method_name: method_name, match_to: match_to ) unless match_to.nil? matchers[method_name.to_sym] = method_matcher_class.new( method_name: method_name, &block ) end |
#matcher(method_name:) ⇒ Object
23 24 25 |
# File 'lib/delorean/ruby/whitelists/base.rb', line 23 def matcher(method_name:) matchers[method_name.to_sym] end |