Class: DocGen::Spec

Inherits:
Struct
  • Object
show all
Defined in:
lib/doc_gen/parser.rb

Overview

A spec represents an ‘it` or `specify` block.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#docstringObject

Returns the value of attribute docstring

Returns:

  • (Object)

    the current value of docstring



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def docstring
  @docstring
end

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def line
  @line
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def name
  @name
end

#parentObject

Returns the value of attribute parent

Returns:

  • (Object)

    the current value of parent



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def parent
  @parent
end

#sourceObject

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



59
60
61
# File 'lib/doc_gen/parser.rb', line 59

def source
  @source
end

Instance Method Details

#full_nameObject

Full display name including ancestors (root component dropped, same as Context).



61
62
63
64
65
66
67
68
69
70
# File 'lib/doc_gen/parser.rb', line 61

def full_name
  parts = [name]
  ctx = parent
  while ctx.is_a?(Context)
    parts.unshift(ctx.name)
    ctx = ctx.parent
  end
  parts.shift if parts.size > 1
  parts.join(' ')
end