Class: Goku::Elements::Base
- Inherits:
-
Object
- Object
- Goku::Elements::Base
- Defined in:
- lib/goku/elements/base.rb
Direct Known Subclasses
Class, Method, MethodSpec, Module, Spec
Instance Attribute Summary collapse
-
#elements ⇒ Object
readonly
Returns the value of attribute elements.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #add(element) ⇒ Object
-
#initialize(name) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Constructor Details
#initialize(name) ⇒ Base
8 9 10 11 |
# File 'lib/goku/elements/base.rb', line 8 def initialize(name) @name = name @elements = [] end |
Instance Attribute Details
#elements ⇒ Object (readonly)
Returns the value of attribute elements.
6 7 8 |
# File 'lib/goku/elements/base.rb', line 6 def elements @elements end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/goku/elements/base.rb', line 5 def name @name end |
Instance Method Details
#add(element) ⇒ Object
13 14 15 |
# File 'lib/goku/elements/base.rb', line 13 def add(element) @elements << element end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/goku/elements/base.rb', line 17 def to_s elements.map(&:to_s).map { |el| el.indent(2) }.join end |