Class: Foo
- Inherits:
-
Object
- Object
- Foo
- Defined in:
- lib/enumerable_weighted_sample.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#weight ⇒ Object
Returns the value of attribute weight.
Instance Method Summary collapse
-
#initialize(name, weight) ⇒ Foo
constructor
A new instance of Foo.
- #inspect ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, weight) ⇒ Foo
73 74 75 76 |
# File 'lib/enumerable_weighted_sample.rb', line 73 def initialize(name, weight) self.name = name self.weight = weight end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
72 73 74 |
# File 'lib/enumerable_weighted_sample.rb', line 72 def name @name end |
#weight ⇒ Object
Returns the value of attribute weight.
72 73 74 |
# File 'lib/enumerable_weighted_sample.rb', line 72 def weight @weight end |
Instance Method Details
#inspect ⇒ Object
80 81 82 |
# File 'lib/enumerable_weighted_sample.rb', line 80 def inspect "#{name}: #{weight}" end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/enumerable_weighted_sample.rb', line 77 def to_s name end |