logic 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -45,9 +45,9 @@ module Decision
45
45
  end
46
46
 
47
47
  def evaluate(conditions)
48
- condition_1 = operand_1.evaluate(conditions)
49
- condition_2 = operand_2.evaluate(conditions)
50
- operator.apply(condition_1, condition_2)
48
+ left = operand_1.evaluate(conditions)
49
+ right = operand_2.evaluate(conditions)
50
+ operator.apply(left, right)
51
51
  end
52
52
 
53
53
  end
data/lib/range.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  class Range
2
2
 
3
- def take(n)
4
- to_a[0,n]
3
+ def take(number_of_elements)
4
+ to_a[0,number_of_elements]
5
5
  end
6
6
 
7
7
  end
data/lib/test_case.rb CHANGED
@@ -46,4 +46,8 @@ class TestCase
46
46
  self
47
47
  end
48
48
 
49
+ def formatted(format)
50
+ "%2d) %s | %3d\n" % [number, conditions.join(' '), output]
51
+ end
52
+
49
53
  end
data/lib/truth_table.rb CHANGED
@@ -9,13 +9,12 @@ class TruthTable
9
9
  end
10
10
 
11
11
  def header
12
- conditions = @test_cases.condition_identifiers.join(" ")
13
- "#{conditions.rjust(conditions.length + 4)} | output\n"
12
+ " %s | output\n" % @test_cases.condition_identifiers.join(" ")
14
13
  end
15
14
 
16
15
  def formatted_cases
17
16
  @test_cases.inject("") do |output, test_case|
18
- output += "#{test_case.number.to_s.rjust(2)}) #{test_case.conditions.join(' ')} | #{test_case.output.to_s.rjust(3)}\n"
17
+ output += test_case.formatted("%2d) %s | %3d\n")
19
18
  end
20
19
  end
21
20
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 5
9
- version: 0.0.5
8
+ - 6
9
+ version: 0.0.6
10
10
  platform: ruby
11
11
  authors:
12
12
  - Bryan Ash