Class: Rucoa::Yard::DefinitionGenerators::AttributeWriterDefinitionGenerator
- Inherits:
-
Base
- Object
- Base
- Rucoa::Yard::DefinitionGenerators::AttributeWriterDefinitionGenerator
- Defined in:
- lib/rucoa/yard/definition_generators/attribute_writer_definition_generator.rb
Constant Summary collapse
- WRITER_METHOD_NAMES =
::Set[ 'attr_accessor', 'attr_writer' ].freeze
Instance Method Summary collapse
Methods inherited from Base
Constructor Details
This class inherits a constructor from Rucoa::Yard::DefinitionGenerators::Base
Instance Method Details
#call ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/rucoa/yard/definition_generators/attribute_writer_definition_generator.rb', line 52 def call return [] unless @node.is_a?(Nodes::SendNode) && WRITER_METHOD_NAMES.include?(@node.name) @node.arguments.filter_map do |argument| next unless argument.respond_to?(:value) Definitions::MethodDefinition.new( description: description, kind: :instance, location: location, method_name: "#{argument.value}=", namespace: @node.namespace, types: return_types.map do |type| Types::MethodType.new( parameters_string: 'value', # TODO return_type: type ) end ) end end |