Class: RFunk::TypeAnnotation
- Inherits:
-
Object
- Object
- RFunk::TypeAnnotation
- Defined in:
- lib/rfunk/attribute/type_annotation.rb
Instance Attribute Summary collapse
-
#parameters ⇒ Object
readonly
Returns the value of attribute parameters.
-
#return ⇒ Object
readonly
Returns the value of attribute return.
Instance Method Summary collapse
-
#initialize(annotation) ⇒ TypeAnnotation
constructor
A new instance of TypeAnnotation.
Constructor Details
#initialize(annotation) ⇒ TypeAnnotation
Returns a new instance of TypeAnnotation.
5 6 7 8 9 |
# File 'lib/rfunk/attribute/type_annotation.rb', line 5 def initialize(annotation) split = (annotation || '').split('->').map(&:strip) @parameters = create_types(split.length > 1 ? Array(split.first) : []) @return = create_types(Array(split.last)) end |
Instance Attribute Details
#parameters ⇒ Object (readonly)
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/rfunk/attribute/type_annotation.rb', line 3 def parameters @parameters end |
#return ⇒ Object (readonly)
Returns the value of attribute return.
3 4 5 |
# File 'lib/rfunk/attribute/type_annotation.rb', line 3 def return @return end |