Class: Srgs::Item
- Inherits:
-
Object
- Object
- Srgs::Item
- Defined in:
- lib/srgs/elements/item.rb
Instance Attribute Summary collapse
-
#elements ⇒ Object
Returns the value of attribute elements.
-
#repeat ⇒ Object
Returns the value of attribute repeat.
-
#repeat_prob ⇒ Object
Returns the value of attribute repeat_prob.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
- #<<(element) ⇒ Object
-
#initialize(element = '', repeat = nil, repeat_prob = nil, weight = nil) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(element = '', repeat = nil, repeat_prob = nil, weight = nil) ⇒ Item
Returns a new instance of Item.
6 7 8 9 10 11 12 |
# File 'lib/srgs/elements/item.rb', line 6 def initialize(element = '', repeat=nil, repeat_prob = nil, weight = nil) @elements = [] @elements << element unless element == '' @repeat = repeat @repeat_prob = repeat_prob @weight = weight end |
Instance Attribute Details
#elements ⇒ Object
Returns the value of attribute elements.
4 5 6 |
# File 'lib/srgs/elements/item.rb', line 4 def elements @elements end |
#repeat ⇒ Object
Returns the value of attribute repeat.
4 5 6 |
# File 'lib/srgs/elements/item.rb', line 4 def repeat @repeat end |
#repeat_prob ⇒ Object
Returns the value of attribute repeat_prob.
4 5 6 |
# File 'lib/srgs/elements/item.rb', line 4 def repeat_prob @repeat_prob end |
#weight ⇒ Object
Returns the value of attribute weight.
4 5 6 |
# File 'lib/srgs/elements/item.rb', line 4 def weight @weight end |
Instance Method Details
#<<(element) ⇒ Object
14 15 16 17 |
# File 'lib/srgs/elements/item.rb', line 14 def <<(element) @elements << element self end |