Sha256: 1550467d2ca769f129c4b5f767c49875dd54fc71ce06272ea11c405614494f0f

Contents?: true

Size: 1.11 KB

Versions: 34

Compression:

Stored size: 1.11 KB

Contents

def init
  return if object.docstring.blank? && !object.has_tag?(:api)
  sections :index, [:private, :deprecated, :abstract, :todo, :note, :returns_void, :text], T('tags')
end

def private
  return unless object.has_tag?(:api) && object.tag(:api).text == 'private'
  erb(:private)
end

def abstract
  return unless object.has_tag?(:abstract)
  erb(:abstract)
end

def deprecated
  return unless object.has_tag?(:deprecated)
  erb(:deprecated)
end

def todo
  return unless object.has_tag?(:todo)
  erb(:todo)
end

def note
  return unless object.has_tag?(:note)
  erb(:note)
end

def returns_void
  return unless object.type == :method
  return if object.name == :initialize && object.scope == :instance
  return unless object.tags(:return).size == 1 && object.tag(:return).types == ['void']
  erb(:returns_void)
end

def docstring_text
  text = ""
  unless object.tags(:overload).size == 1 && object.docstring.empty?
    text = object.docstring
  end
  
  if text.strip.empty? && object.tags(:return).size == 1 && object.tag(:return).text
    text = object.tag(:return).text.gsub(/\A([a-z])/) {|x| x.upcase }
  end
  
  text.strip
end

Version data entries

34 entries across 34 versions & 4 rubygems

Version Path
challah-0.6.2 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.6.1 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.6.0 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.5.4 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.5.3 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.5.2 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.5.1 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.5.0 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.4.1 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.4.0 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.5 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.4 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.3 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.2 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.1 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.3.0 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.2.1 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
challah-0.2.0 vendor/bundle/gems/yard-0.7.5/templates/default/docstring/setup.rb
yard-0.7.5 templates/default/docstring/setup.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/yard-0.7.4/templates/default/docstring/setup.rb