Class: Triple
- Inherits:
-
Object
- Object
- Triple
- Defined in:
- lib/static_ruby.rb
Instance Attribute Summary collapse
-
#first ⇒ Object
readonly
Returns the value of attribute first.
-
#second ⇒ Object
readonly
Returns the value of attribute second.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#third ⇒ Object
readonly
Returns the value of attribute third.
Instance Method Summary collapse
- #!=(o) ⇒ Object
- #==(o) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(first, second, third) ⇒ Triple
constructor
A new instance of Triple.
- #to_a ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(first, second, third) ⇒ Triple
Returns a new instance of Triple.
36 37 38 39 40 41 |
# File 'lib/static_ruby.rb', line 36 def initialize(first, second, third) @first = first @second = second @third = third @size = 3 end |
Instance Attribute Details
#first ⇒ Object (readonly)
Returns the value of attribute first.
34 35 36 |
# File 'lib/static_ruby.rb', line 34 def first @first end |
#second ⇒ Object (readonly)
Returns the value of attribute second.
34 35 36 |
# File 'lib/static_ruby.rb', line 34 def second @second end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
34 35 36 |
# File 'lib/static_ruby.rb', line 34 def size @size end |
#third ⇒ Object (readonly)
Returns the value of attribute third.
34 35 36 |
# File 'lib/static_ruby.rb', line 34 def third @third end |
Instance Method Details
#!=(o) ⇒ Object
55 56 57 |
# File 'lib/static_ruby.rb', line 55 def !=(o) @first != o.first || @second != o.second || @third != o.third end |
#==(o) ⇒ Object
51 52 53 |
# File 'lib/static_ruby.rb', line 51 def ==(o) @first == o.first && @second == o.second && @third == o.third end |
#each(&block) ⇒ Object
59 60 61 62 63 |
# File 'lib/static_ruby.rb', line 59 def each(&block) block.call(@first) block.call(@second) block.call(@third) end |
#to_a ⇒ Object
43 44 45 |
# File 'lib/static_ruby.rb', line 43 def to_a [@first, @second, @third] end |
#to_s ⇒ Object
47 48 49 |
# File 'lib/static_ruby.rb', line 47 def to_s "Triple(#{@first} #{@second} #{@third})" end |