0.0
The project is in a healthy, maintained state
A YARD extension for documenting Solargraph tags.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

~> 13.2
~> 3.5
~> 0.14

Runtime

~> 0.9
 Project Readme

yard-solargraph

A YARD extension for documenting Solargraph tags.

Installation

Install the gem and add to the application's Gemfile by executing:

bundle add yard-solargraph

If bundler is not being used to manage dependencies, install the gem by executing:

gem install yard-solargraph

Usage

To include the plugin when you generate yardocs from the command line:

yardoc --plugin yard-solargraph

To ensure that the plugin gets included when generating yardocs for gems:

  1. Add yard-solargraph to your gemspec
  2. Create a .yardopts file in your gem's root directory with the plugin option:
    --plugin yard-solargraph
    

Additional Tags

The plugin adds two tags to your YARD documentation: @generic and @yieldreceiver.

@generic

Use the @generic tag to reference parametrized types.

# @generic T
class Example
  # @param [generic<T>]
  def initialize value
    @value = value
  end

  # @return [generic<T>]
  attr_reader :value
end

# @return [Example<String>]
def string_example
  Example.new('test')
end

string_example.value # => Solargraph will infer that #value returns a String

@yieldreceiver

Use the @yieldreceiver tag to document the type of receiver that a method will use to evaluate a block.

# @yieldreceiver [Array]
def eval_in_array &block
  [].instance_eval &block
end

eval_in_array do
  length # => Solargraph will infer that this is an Array#length call
end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and the created tag, and push the .gem file to rubygems.org.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/yard-solargraph.