Class: Alchemist::Formula

Inherits:
Object show all
Defined in:
lib/alchemist-server/formula.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(elem_1, elem_2, result) ⇒ Formula

Returns a new instance of Formula.



6
7
8
9
10
# File 'lib/alchemist-server/formula.rb', line 6

def initialize(elem_1, elem_2, result)
  @elem_1 = elem_1
  @elem_2 = elem_2
  @result = result
end

Instance Attribute Details

#elem_1Object (readonly)

Returns the value of attribute elem_1.



4
5
6
# File 'lib/alchemist-server/formula.rb', line 4

def elem_1
  @elem_1
end

#elem_2Object (readonly)

Returns the value of attribute elem_2.



4
5
6
# File 'lib/alchemist-server/formula.rb', line 4

def elem_2
  @elem_2
end

#resultObject (readonly)

Returns the value of attribute result.



4
5
6
# File 'lib/alchemist-server/formula.rb', line 4

def result
  @result
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
19
20
21
# File 'lib/alchemist-server/formula.rb', line 16

def ==(other)
  other.class == self.class &&
  other.elem_1 == elem_1 &&
  other.elem_2 == elem_2 &&
  other.result == result
end

#to_sObject



12
13
14
# File 'lib/alchemist-server/formula.rb', line 12

def to_s
  "#{@elem_1}#{@elem_2}#{@result}"
end