Sha256: 02e335c274dc1f1bbbbb8346a0e488fcbf49c957ec9cd182cac274153f315383

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

# CommentCollector

Get source code comments of Ruby.

require RUBY_VERSION >= '2.6.0'


## Installation

Or install it yourself as:

```
$ gem install comment_collector
```

## Usage

`example.rb`

```ruby
# class comment
# this is sample
class Foo
  BAR = 'hello' # string

  # method
  def say
    'hi'
  end
end

=begin
multi line
commens
=end
```

`comment.rb`

```ruby
require 'comment_collector'

comments = CommentCollector.get(File.read('example.rb'))

puts '=' * 20

comments.each do |comment|
  puts comment.value
  puts '=' * 20
end
```

result

```
$ ruby comment.rb
====================
# class comment
# this is sample
====================
# string
====================
# method
====================
=begin
multi line
commens
=end
====================
```


## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

## Code of Conduct

Everyone interacting in the CommentCollector project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/comment_collector/blob/master/CODE_OF_CONDUCT.md).

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
comment_collector-0.0.1 README.md