Class: Loom::MethodSignature::MatchSpec
- Inherits:
-
Object
- Object
- Loom::MethodSignature::MatchSpec
- Defined in:
- lib/loom/method_signature.rb
Defined Under Namespace
Classes: Builder
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(req_args: nil, opt_args: nil, has_rest_args: nil, keyreq_args: nil, key_args: nil, has_keyrest_args: nil, has_block: nil) ⇒ MatchSpec
constructor
A new instance of MatchSpec.
- #match?(method) ⇒ Boolean
Constructor Details
#initialize(req_args: nil, opt_args: nil, has_rest_args: nil, keyreq_args: nil, key_args: nil, has_keyrest_args: nil, has_block: nil) ⇒ MatchSpec
Returns a new instance of MatchSpec.
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/loom/method_signature.rb', line 90 def initialize( req_args: nil, opt_args: nil, has_rest_args: nil, keyreq_args: nil, key_args: nil, has_keyrest_args: nil, has_block: nil) @req_args = req_args @opt_args = opt_args @has_rest_args = has_rest_args @keyreq_args = keyreq_args @key_args = key_args @has_keyrest_args = has_keyrest_args @has_block = has_block end |
Class Method Details
Instance Method Details
#match?(method) ⇒ Boolean
108 109 110 111 112 113 114 115 116 117 |
# File 'lib/loom/method_signature.rb', line 108 def match?(method) method_sig = MethodSignature.new method # *args definition matches any call. return true if @has_rest_args check_ordered_args(method_sig) && check_keyword_args(method_sig) && check_block_args(method_sig) end |