Class: VectorDisperso
- Inherits:
-
Object
- Object
- VectorDisperso
- Defined in:
- lib/p10lppt13.rb
Overview
Clase de Vectores dispersos
Instance Attribute Summary collapse
-
#vector ⇒ Object
readonly
Returns the value of attribute vector.
Instance Method Summary collapse
- #[](i) ⇒ Object
-
#initialize(h = {}) ⇒ VectorDisperso
constructor
A new instance of VectorDisperso.
- #to_s ⇒ Object
Constructor Details
#initialize(h = {}) ⇒ VectorDisperso
Returns a new instance of VectorDisperso.
233 234 235 236 |
# File 'lib/p10lppt13.rb', line 233 def initialize(h = {}) @vector = Hash.new(0) @vector = @vector.merge!(h) end |
Instance Attribute Details
#vector ⇒ Object (readonly)
Returns the value of attribute vector.
231 232 233 |
# File 'lib/p10lppt13.rb', line 231 def vector @vector end |
Instance Method Details
#[](i) ⇒ Object
238 239 240 |
# File 'lib/p10lppt13.rb', line 238 def [](i) @vector[i] end |
#to_s ⇒ Object
242 243 244 |
# File 'lib/p10lppt13.rb', line 242 def to_s @vector.to_s end |