Class: YARD::Virtus::Declarations::Type
- Inherits:
-
Object
- Object
- YARD::Virtus::Declarations::Type
- Defined in:
- lib/yard/virtus/declarations/type.rb
Overview
Type declaration wraps AST which represents type of Virtus attribute
Instance Attribute Summary collapse
-
#ast ⇒ Object
readonly
Returns the value of attribute ast.
Instance Method Summary collapse
-
#initialize(ast) ⇒ Type
constructor
A new instance of Type.
- #yard_type_string ⇒ Object
Constructor Details
#initialize(ast) ⇒ Type
Returns a new instance of Type.
16 17 18 |
# File 'lib/yard/virtus/declarations/type.rb', line 16 def initialize(ast) @ast = ast end |
Instance Attribute Details
#ast ⇒ Object (readonly)
Returns the value of attribute ast.
13 14 15 |
# File 'lib/yard/virtus/declarations/type.rb', line 13 def ast @ast end |
Instance Method Details
#yard_type_string ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/yard/virtus/declarations/type.rb', line 20 def yard_type_string if association?(ast) yard_type_from_association(ast) elsif collection?(ast) yard_type_from_collection(ast) elsif ast.ref? yard_type_from_reference(ast) elsif !ast[0].nil? Type.new(ast[0]).yard_type_string else nil end end |