Class: SandiMeter::Class
- Inherits:
-
Object
- Object
- SandiMeter::Class
- Defined in:
- lib/sandi_meter/sandi_meter/class.rb
Constant Summary collapse
- MAX_LOC =
100
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#first_line ⇒ Object
Returns the value of attribute first_line.
-
#last_line ⇒ Object
Returns the value of attribute last_line.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #controller? ⇒ Boolean
-
#initialize(params = {}) ⇒ Class
constructor
A new instance of Class.
- #misindented? ⇒ Boolean
- #size ⇒ Object
- #small? ⇒ Boolean
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
#controller ⇒ Object
Returns the value of attribute controller.
5 6 7 |
# File 'lib/sandi_meter/sandi_meter/class.rb', line 5 def controller @controller end |
#first_line ⇒ Object
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_line ⇒ Object
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 |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/sandi_meter/sandi_meter/class.rb', line 5 def name @name end |
#path ⇒ Object
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
25 26 27 |
# File 'lib/sandi_meter/sandi_meter/class.rb', line 25 def controller? !!(path =~ /\w+_controller.rb$/) end |
#misindented? ⇒ Boolean
21 22 23 |
# File 'lib/sandi_meter/sandi_meter/class.rb', line 21 def misindented? !!(last_line) end |
#size ⇒ Object
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
17 18 19 |
# File 'lib/sandi_meter/sandi_meter/class.rb', line 17 def small? last_line && size <= MAX_LOC end |