Class: SandiMeter::Method

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

Constant Summary collapse

MAX_LOC =
5

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Method

Returns a new instance of Method.


7
8
9
10
11
12
# File 'lib/sandi_meter/sandi_meter/method.rb', line 7

def initialize(params = {})
  params.each do |key, value|
    instance_variable_set("@#{key}", value)
  end
  @ivars = []
end

Instance Attribute Details

#first_lineObject

Returns the value of attribute first_line


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def first_line
  @first_line
end

#ivarsObject

Returns the value of attribute ivars


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def ivars
  @ivars
end

#last_lineObject

Returns the value of attribute last_line


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def last_line
  @last_line
end

#misindentedObject

Returns the value of attribute misindented


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def misindented
  @misindented
end

#nameObject

Returns the value of attribute name


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def name
  @name
end

#number_of_argumentsObject

Returns the value of attribute number_of_arguments


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def number_of_arguments
  @number_of_arguments
end

#pathObject

Returns the value of attribute path


5
6
7
# File 'lib/sandi_meter/sandi_meter/method.rb', line 5

def path
  @path
end

Instance Method Details

#misindented?Boolean

Returns:

  • (Boolean)

18
19
20
# File 'lib/sandi_meter/sandi_meter/method.rb', line 18

def misindented?
  !(@last_line)
end

#sizeObject


14
15
16
# File 'lib/sandi_meter/sandi_meter/method.rb', line 14

def size
  @last_line - @first_line - 1 if @last_line
end

#small?Boolean

Returns:

  • (Boolean)

22
23
24
# File 'lib/sandi_meter/sandi_meter/method.rb', line 22

def small?
  size <= MAX_LOC if @last_line
end