Class: RFunk::TypeAnnotation

Inherits:
Object
  • Object
show all
Defined in:
lib/rfunk/attribute/type_annotation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#parametersObject (readonly)

Returns the value of attribute parameters.



3
4
5
# File 'lib/rfunk/attribute/type_annotation.rb', line 3

def parameters
  @parameters
end

#returnObject (readonly)

Returns the value of attribute return.



3
4
5
# File 'lib/rfunk/attribute/type_annotation.rb', line 3

def return
  @return
end