Class: SandiMeter::Class

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

Constant Summary collapse

MAX_LOC =
100

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params = {}) ⇒ Class

Returns a new instance of Class.



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

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

Instance Attribute Details

#controllerObject

Returns the value of attribute controller.



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

def controller
  @controller
end

#first_lineObject

Returns the value of attribute first_line.



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

def first_line
  @first_line
end

#last_lineObject

Returns the value of attribute last_line.



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

def last_line
  @last_line
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#pathObject

Returns the value of attribute path.



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

def path
  @path
end

Instance Method Details

#controller?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/sandi_meter/sandi_meter/class.rb', line 25

def controller?
  !!(path =~ /\w+_controller.rb$/)
end

#misindented?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/sandi_meter/sandi_meter/class.rb', line 21

def misindented?
  !!(last_line)
end

#sizeObject



13
14
15
# File 'lib/sandi_meter/sandi_meter/class.rb', line 13

def size
  last_line and (last_line - first_line - 1)
end

#small?Boolean

Returns:

  • (Boolean)


17
18
19
# File 'lib/sandi_meter/sandi_meter/class.rb', line 17

def small?
  last_line && size <= MAX_LOC
end