Class: Docurium::Warning

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

Defined Under Namespace

Classes: MissingDocumentation, SignatureChanged, UnmatchedParameter

Constant Summary collapse

WARNINGS =
[
  :unmatched_param,
  :signature_changed,
  :missing_documentation,
]

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(warning, type, identifier, opts = {}) ⇒ Warning

Returns a new instance of Warning.

Raises:

  • (ArgumentError)


278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
# File 'lib/docurium.rb', line 278

def initialize(warning, type, identifier, opts = {})
  raise ArgumentError.new("invalid warning class") unless WARNINGS.include?(warning)
  @warning = warning
  @type = type
  @identifier = identifier
  if type = opts.delete(:type)
    @file = type[:file]
    if input_dir = opts.delete(:input_dir)
      File.expand_path(File.join(input_dir, @file))
    end
    @file ||= "<missing>"
    @line = type[:line] || 1
    @column = type[:column] || 1
  end
end

Instance Attribute Details

#columnObject (readonly)

Returns the value of attribute column.



276
277
278
# File 'lib/docurium.rb', line 276

def column
  @column
end

#fileObject (readonly)

Returns the value of attribute file.



276
277
278
# File 'lib/docurium.rb', line 276

def file
  @file
end

#identifierObject (readonly)

Returns the value of attribute identifier.



276
277
278
# File 'lib/docurium.rb', line 276

def identifier
  @identifier
end

#lineObject (readonly)

Returns the value of attribute line.



276
277
278
# File 'lib/docurium.rb', line 276

def line
  @line
end

#typeObject (readonly)

Returns the value of attribute type.



276
277
278
# File 'lib/docurium.rb', line 276

def type
  @type
end

#warningObject (readonly)

Returns the value of attribute warning.



276
277
278
# File 'lib/docurium.rb', line 276

def warning
  @warning
end

Instance Method Details

#messageObject



294
295
296
297
# File 'lib/docurium.rb', line 294

def message
  msg = self._message
  msg.kind_of?(Array) ? msg.shift % msg.map {|a| self.send(a).to_s } : msg
end