Class: Uinit::Sig::Parameter
- Inherits:
-
Uinit::Struct
- Object
- Uinit::Struct
- Uinit::Sig::Parameter
- Defined in:
- lib/uinit/sig/parameter.rb
Instance Method Summary collapse
- #is!(value) ⇒ Object
- #opt? ⇒ Boolean
- #opt_arg? ⇒ Boolean
- #opt_kwarg? ⇒ Boolean
- #req_arg? ⇒ Boolean
- #req_kwarg? ⇒ Boolean
- #rest_arg? ⇒ Boolean
- #rest_kwarg? ⇒ Boolean
- #typed? ⇒ Boolean
Instance Method Details
#is!(value) ⇒ Object
47 48 49 50 51 |
# File 'lib/uinit/sig/parameter.rb', line 47 def is!(value) type.is!(value) rescue Type::Error => e raise ParameterTypeError.new(self, e) end |
#opt? ⇒ Boolean
39 40 41 |
# File 'lib/uinit/sig/parameter.rb', line 39 def opt? opt_arg? || opt_kwarg? end |
#opt_arg? ⇒ Boolean
19 20 21 |
# File 'lib/uinit/sig/parameter.rb', line 19 def opt_arg? parameter_type == :opt end |
#opt_kwarg? ⇒ Boolean
31 32 33 |
# File 'lib/uinit/sig/parameter.rb', line 31 def opt_kwarg? parameter_type == :key end |
#req_arg? ⇒ Boolean
15 16 17 |
# File 'lib/uinit/sig/parameter.rb', line 15 def req_arg? parameter_type == :req end |
#req_kwarg? ⇒ Boolean
27 28 29 |
# File 'lib/uinit/sig/parameter.rb', line 27 def req_kwarg? parameter_type == :keyreq end |
#rest_arg? ⇒ Boolean
23 24 25 |
# File 'lib/uinit/sig/parameter.rb', line 23 def rest_arg? parameter_type == :rest end |
#rest_kwarg? ⇒ Boolean
35 36 37 |
# File 'lib/uinit/sig/parameter.rb', line 35 def rest_kwarg? parameter_type == :keyrest end |
#typed? ⇒ Boolean
43 44 45 |
# File 'lib/uinit/sig/parameter.rb', line 43 def typed? !type.nil? end |