Class: Preek::SmellKlass
- Inherits:
-
Object
- Object
- Preek::SmellKlass
- Defined in:
- lib/preek/smell_klass.rb
Overview
A container for smells in a class
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add(smell) ⇒ Object (also: #<<)
-
#initialize(name) ⇒ SmellKlass
constructor
A new instance of SmellKlass.
- #smells ⇒ Object
Constructor Details
#initialize(name) ⇒ SmellKlass
Returns a new instance of SmellKlass.
6 7 8 9 |
# File 'lib/preek/smell_klass.rb', line 6 def initialize(name) @name = name @smells = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/preek/smell_klass.rb', line 4 def name @name end |
Instance Method Details
#add(smell) ⇒ Object Also known as: <<
11 12 13 |
# File 'lib/preek/smell_klass.rb', line 11 def add(smell) @smells << smell end |
#smells ⇒ Object
17 18 19 |
# File 'lib/preek/smell_klass.rb', line 17 def smells @smells.map(&:smell_string) end |