Class: ReadmeYard::ExampleTag

Inherits:
Object
  • Object
show all
Defined in:
lib/readme_yard/example_tag.rb

Class Method Summary collapse

Class Method Details

.format_markdown(yard_object, yard_tags) ⇒ Object



4
5
6
# File 'lib/readme_yard/example_tag.rb', line 4

def format_markdown(yard_object, yard_tags)
  yard_tags.map { |tag| format_tag_markdown(yard_object, tag) }.join("\n")
end

.format_ruby(text) ⇒ Object



13
14
15
# File 'lib/readme_yard/example_tag.rb', line 13

def format_ruby(text)
  "```ruby\n#{text}\n```\n"
end

.format_tag_markdown(yard_object, tag) ⇒ Object



8
9
10
11
# File 'lib/readme_yard/example_tag.rb', line 8

def format_tag_markdown(yard_object, tag)
  text = tag.text.empty? ? yard_object.source : tag.text
  format_ruby(text)
end