Exception: NoMatchingPatternKeyError
- Inherits:
-
NoMatchingPatternError
- Object
- Exception
- StandardError
- NoMatchingPatternError
- NoMatchingPatternKeyError
- Defined in:
- error.c
Instance Method Summary collapse
-
#new(message = nil, matchee: nil, key: nil) ⇒ Object
constructor
Construct a new
NoMatchingPatternKeyError
exception with the given message, matchee and key. -
#key ⇒ Object
Return the key caused this NoMatchingPatternKeyError exception.
-
#matchee ⇒ Object
Return the matchee associated with this NoMatchingPatternKeyError exception.
Methods inherited from Exception
#==, #backtrace, #backtrace_locations, #cause, #detailed_message, #exception, exception, #full_message, #inspect, #message, #set_backtrace, #to_s, to_tty?
Constructor Details
#new(message = nil, matchee: nil, key: nil) ⇒ Object
Construct a new NoMatchingPatternKeyError
exception with the given message, matchee and key.
2909 2910 2911 2912 2913 2914 2915 2916 2917 2918 2919 2920 2921 2922 2923 2924 2925 2926 2927 2928 2929 2930 2931 |
# File 'error.c', line 2909
static VALUE
no_matching_pattern_key_err_initialize(int argc, VALUE *argv, VALUE self)
{
VALUE options;
rb_call_super(rb_scan_args(argc, argv, "01:", NULL, &options), argv);
if (!NIL_P(options)) {
ID keywords[2];
VALUE values[numberof(keywords)];
int i;
keywords[0] = id_matchee;
keywords[1] = id_key;
rb_get_kwargs(options, keywords, 0, numberof(values), values);
for (i = 0; i < numberof(values); ++i) {
if (!UNDEF_P(values[i])) {
rb_ivar_set(self, keywords[i], values[i]);
}
}
}
return self;
}
|
Instance Method Details
#key ⇒ Object
Return the key caused this NoMatchingPatternKeyError exception.
2891 2892 2893 2894 2895 2896 2897 2898 2899 |
# File 'error.c', line 2891
static VALUE
no_matching_pattern_key_err_key(VALUE self)
{
VALUE key;
key = rb_ivar_lookup(self, id_key, Qundef);
if (!UNDEF_P(key)) return key;
rb_raise(rb_eArgError, "no key is available");
}
|
#matchee ⇒ Object
Return the matchee associated with this NoMatchingPatternKeyError exception.
2874 2875 2876 2877 2878 2879 2880 2881 2882 |
# File 'error.c', line 2874
static VALUE
no_matching_pattern_key_err_matchee(VALUE self)
{
VALUE matchee;
matchee = rb_ivar_lookup(self, id_matchee, Qundef);
if (!UNDEF_P(matchee)) return matchee;
rb_raise(rb_eArgError, "no matchee is available");
}
|