Class: Moult::Report::Method

Inherits:
Object
  • Object
show all
Defined in:
lib/moult/report.rb

Overview

One method definition with its complexity.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(symbol_id:, name:, span:, abc:, confidence: nil, category: nil) ⇒ Method

Returns a new instance of Method.

Parameters:

  • symbol_id (String)

    stable join key: ":<start_line>:"

  • name (String)

    lexical fully-qualified name (Class#method / Class.method)

  • span (Span)

    definition source range

  • abc (Float)

    flog-style weighted ABC score



93
94
95
96
97
98
99
100
# File 'lib/moult/report.rb', line 93

def initialize(symbol_id:, name:, span:, abc:, confidence: nil, category: nil)
  @symbol_id = symbol_id
  @name = name
  @span = span
  @abc = abc
  @confidence = confidence
  @category = category
end

Instance Attribute Details

#abcObject (readonly)

Returns the value of attribute abc.



87
88
89
# File 'lib/moult/report.rb', line 87

def abc
  @abc
end

#categoryObject (readonly)

Returns the value of attribute category.



87
88
89
# File 'lib/moult/report.rb', line 87

def category
  @category
end

#confidenceObject (readonly)

Returns the value of attribute confidence.



87
88
89
# File 'lib/moult/report.rb', line 87

def confidence
  @confidence
end

#nameObject (readonly)

Returns the value of attribute name.



87
88
89
# File 'lib/moult/report.rb', line 87

def name
  @name
end

#spanObject (readonly)

Returns the value of attribute span.



87
88
89
# File 'lib/moult/report.rb', line 87

def span
  @span
end

#symbol_idObject (readonly)

Returns the value of attribute symbol_id.



87
88
89
# File 'lib/moult/report.rb', line 87

def symbol_id
  @symbol_id
end

Instance Method Details

#to_hObject



102
103
104
105
106
107
108
109
110
111
# File 'lib/moult/report.rb', line 102

def to_h
  {
    symbol_id: symbol_id,
    name: name,
    span: span.to_h,
    abc: abc,
    confidence: confidence,
    category: category
  }
end