Class: Contracts::Formatters::TypesAST
- Inherits:
-
Object
- Object
- Contracts::Formatters::TypesAST
- Defined in:
- lib/yard-contracts/formatters.rb
Instance Method Summary collapse
-
#initialize(types) ⇒ TypesAST
constructor
A new instance of TypesAST.
- #result ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(types) ⇒ TypesAST
Returns a new instance of TypesAST.
96 97 98 |
# File 'lib/yard-contracts/formatters.rb', line 96 def initialize(types) @types = types[0..-2] end |
Instance Method Details
#result ⇒ Object
113 114 115 116 |
# File 'lib/yard-contracts/formatters.rb', line 113 def result # Get the result out of the `param => result` part [@types.last.last.last.source, @types.last.last.last] end |
#to_a ⇒ Object
100 101 102 103 104 105 106 107 108 109 110 111 |
# File 'lib/yard-contracts/formatters.rb', line 100 def to_a types = [] @types.each_with_index do |type, i| if i == @types.length - 1 # Get the param out of the `param => result` part types << [type.first.first.source, type.first.first] else types << [type.source, type] end end types end |