Class: WeightedSelection::Item
- Inherits:
-
Object
- Object
- WeightedSelection::Item
- Defined in:
- lib/weighted_selection/item.rb
Instance Attribute Summary collapse
-
#value ⇒ Object
readonly
Returns the value of attribute value.
-
#weight ⇒ Object
readonly
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(weight, value) ⇒ Item
constructor
A new instance of Item.
Constructor Details
#initialize(weight, value) ⇒ Item
Returns a new instance of Item.
3 4 5 6 |
# File 'lib/weighted_selection/item.rb', line 3 def initialize(weight, value) @weight = weight @value = value end |
Instance Attribute Details
#value ⇒ Object (readonly)
Returns the value of attribute value.
7 8 9 |
# File 'lib/weighted_selection/item.rb', line 7 def value @value end |
#weight ⇒ Object (readonly)
Returns the value of attribute weight.
7 8 9 |
# File 'lib/weighted_selection/item.rb', line 7 def weight @weight end |