Class: PreCommit::Line

Inherits:
Struct
  • Object
show all
Defined in:
lib/pre-commit/line.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#codeObject

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code


2
3
4
# File 'lib/pre-commit/line.rb', line 2

def code
  @code
end

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file


2
3
4
# File 'lib/pre-commit/line.rb', line 2

def file
  @file
end

#lineObject

Returns the value of attribute line

Returns:

  • (Object)

    the current value of line


2
3
4
# File 'lib/pre-commit/line.rb', line 2

def line
  @line
end

#messageObject

Returns the value of attribute message

Returns:

  • (Object)

    the current value of message


2
3
4
# File 'lib/pre-commit/line.rb', line 2

def message
  @message
end

Instance Method Details

#to_sObject


4
5
6
7
8
9
10
11
12
# File 'lib/pre-commit/line.rb', line 4

def to_s
  result = message.to_s
  unless empty? file
    result = "#{result}#{"\n" unless empty?(result)}#{file}"
    result = "#{result}:#{line}" unless empty? line
    result = "#{result}:#{code}" unless empty? code
  end
  result
end