Class: Code::Type::Maybe
- Inherits:
-
Code::Type
- Object
- Code::Type
- Code::Type::Maybe
- Defined in:
- lib/code/type/maybe.rb
Instance Attribute Summary collapse
-
#clazz ⇒ Object
readonly
Returns the value of attribute clazz.
Instance Method Summary collapse
-
#initialize(clazz) ⇒ Maybe
constructor
A new instance of Maybe.
- #max_arguments ⇒ Object
- #min_arguments ⇒ Object
- #name ⇒ Object
- #valid?(argument) ⇒ Boolean
Methods inherited from Code::Type
#max_arguments_of, #maybe, #min_arguments_of, #repeat, #valid_for?, #|
Constructor Details
#initialize(clazz) ⇒ Maybe
Returns a new instance of Maybe.
8 9 10 |
# File 'lib/code/type/maybe.rb', line 8 def initialize(clazz) @clazz = clazz end |
Instance Attribute Details
#clazz ⇒ Object (readonly)
Returns the value of attribute clazz.
6 7 8 |
# File 'lib/code/type/maybe.rb', line 6 def clazz @clazz end |
Instance Method Details
#max_arguments ⇒ Object
21 22 23 |
# File 'lib/code/type/maybe.rb', line 21 def max_arguments max_arguments_of(clazz) end |
#min_arguments ⇒ Object
17 18 19 |
# File 'lib/code/type/maybe.rb', line 17 def min_arguments 0 end |
#name ⇒ Object
25 26 27 |
# File 'lib/code/type/maybe.rb', line 25 def name "#{clazz.name}.maybe" end |