flex_array 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
Files changed (45) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +0 -15
  3. data/.reek.yml +17 -0
  4. data/README.md +11 -0
  5. data/bench/benchmark.rb +243 -0
  6. data/bench/results.txt +97 -0
  7. data/flex_array.gemspec +5 -9
  8. data/lib/flex_array.rb +13 -30
  9. data/lib/flex_array/array.rb +9 -24
  10. data/lib/flex_array/flex_array_append.rb +4 -23
  11. data/lib/flex_array/flex_array_each.rb +33 -208
  12. data/lib/flex_array/flex_array_forever.rb +6 -4
  13. data/lib/flex_array/flex_array_index.rb +4 -29
  14. data/lib/flex_array/flex_array_new.rb +9 -56
  15. data/lib/flex_array/flex_array_process.rb +23 -63
  16. data/lib/flex_array/flex_array_reshape.rb +13 -23
  17. data/lib/flex_array/flex_array_transpose.rb +7 -16
  18. data/lib/flex_array/flex_array_validate.rb +5 -14
  19. data/lib/flex_array/integer.rb +4 -13
  20. data/lib/flex_array/object.rb +4 -13
  21. data/lib/flex_array/range.rb +4 -13
  22. data/lib/flex_array/spec_array.rb +5 -9
  23. data/lib/flex_array/spec_component.rb +14 -22
  24. data/lib/flex_array/version.rb +1 -2
  25. data/rakefile.rb +0 -10
  26. data/reek.txt +9 -2
  27. data/tests/array_test.rb +0 -4
  28. data/tests/flex_array_append_test.rb +0 -23
  29. data/tests/flex_array_each_test.rb +483 -487
  30. data/tests/flex_array_index_test.rb +0 -4
  31. data/tests/flex_array_new_test.rb +0 -4
  32. data/tests/flex_array_reshape_test.rb +4 -4
  33. data/tests/flex_array_test.rb +0 -4
  34. data/tests/flex_array_transpose_test.rb +0 -4
  35. data/tests/flex_array_validate_test.rb +0 -4
  36. data/tests/integer_test.rb +0 -4
  37. data/tests/object_test.rb +0 -4
  38. data/tests/range_test.rb +0 -4
  39. data/tests/spec_array_test.rb +0 -4
  40. data/tests/spec_component_test.rb +0 -4
  41. metadata +12 -43
  42. data/docs/Flex_Array_UG.odt +0 -0
  43. data/docs/Flex_Array_UG_Version_0_3_0.pdf +0 -0
  44. data/flex_array.reek +0 -109
  45. data/sire.rb +0 -82
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayIndexTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_that_it_indexes_correctly
12
8
  q1 = FlexArray.new([3, 3, 3]) {|i| i.dup}
13
9
 
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayNewTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_the_new_method
12
8
  q1 = FlexArray.new(10, 0)
13
9
  a1 = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayReshapeTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_the_reshape_method
12
8
  ba1 = [[0,0], [0,1], [0,2], [0,3],
13
9
  [1,0], [1,1], [1,2], [1,3],
@@ -59,5 +55,9 @@ class FlexArrayReshapeTester < Minitest::Test
59
55
  a = [[0,0],[0,1],[0,2],[1,0],[1,1],[1,2]]
60
56
  assert_equal(a, fa.to_a)
61
57
  assert(fa.array_data.object_id != fa.to_a.object_id)
58
+
59
+ fb = fa.transpose(0,1)
60
+ b = [[0,0],[1,0],[0,1],[1,1],[0,2],[1,2]]
61
+ assert_equal(b, fb.to_a)
62
62
  end
63
63
  end
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_version_reporting
12
8
  f = FlexArray.new([3,3], 'test')
13
9
 
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayTransposeTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_the_transpose_em_method
12
8
  f = FlexArray.new([3,3]) { |i| i[0]*3 + i[1] }
13
9
  a = [0,1,2,
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class FlexArrayValidateTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_the_compatible_method
12
8
  f = FlexArray.new([3,3], 'f')
13
9
  g = FlexArray.new([0...3,0...3], 'g')
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class IntegerTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_that_to_spec_component_works
12
8
  lc = (10).to_spec_component(3)
13
9
  assert_equal(0...10, lc.range)
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class ObjectTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_that_to_spec_component_fails
12
8
  obj = Object.new
13
9
  assert_raises(ArgumentError) { obj.to_spec_component(42) }
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class RangeTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_that_to_spec_component_works
12
8
  lc = (0...10).to_spec_component(3)
13
9
  assert_equal(0...10, lc.range)
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class SpecArrayTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def test_that_it_builds_specs
12
8
  spec = SpecArray.new([0...10, 0...8])
13
9
  assert(2, spec.spec_dimensions)
@@ -1,13 +1,9 @@
1
1
  require_relative '../lib/flex_array'
2
2
  gem 'minitest'
3
3
  require 'minitest/autorun'
4
- require 'minitest_visible'
5
4
 
6
5
  class SpecComponentTester < Minitest::Test
7
6
 
8
- #Track mini-test progress.
9
- include MinitestVisible
10
-
11
7
  def setup
12
8
  @lc = SpecComponent.new(1..5, 10)
13
9
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: flex_array
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Camilleri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-23 00:00:00.000000000 Z
11
+ date: 2020-03-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,28 +30,28 @@ dependencies:
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 12.3.3
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 12.3.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: reek
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: 1.3.8
47
+ version: 5.0.2
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: 1.3.8
54
+ version: 5.0.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -66,34 +66,6 @@ dependencies:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 4.7.5
69
- - !ruby/object:Gem::Dependency
70
- name: rdoc
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: 4.0.1
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: 4.0.1
83
- - !ruby/object:Gem::Dependency
84
- name: minitest_visible
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: 0.1.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: 0.1.0
97
69
  - !ruby/object:Gem::Dependency
98
70
  name: in_array
99
71
  requirement: !ruby/object:Gem::Requirement
@@ -112,18 +84,17 @@ description: 'A flexible, multidimensional array class for Ruby. '
112
84
  email: peter.c.camilleri@gmail.com
113
85
  executables: []
114
86
  extensions: []
115
- extra_rdoc_files:
116
- - license.txt
87
+ extra_rdoc_files: []
117
88
  files:
118
89
  - ".gitignore"
90
+ - ".reek.yml"
119
91
  - CODE_OF_CONDUCT.md
120
92
  - Gemfile
121
93
  - README.md
122
- - docs/Flex_Array_UG.odt
123
- - docs/Flex_Array_UG_Version_0_3_0.pdf
94
+ - bench/benchmark.rb
95
+ - bench/results.txt
124
96
  - flex_array
125
97
  - flex_array.gemspec
126
- - flex_array.reek
127
98
  - irbt.rb
128
99
  - lib/flex_array.rb
129
100
  - lib/flex_array/array.rb
@@ -145,7 +116,6 @@ files:
145
116
  - license.txt
146
117
  - rakefile.rb
147
118
  - reek.txt
148
- - sire.rb
149
119
  - tests/array_test.rb
150
120
  - tests/flex_array_append_test.rb
151
121
  - tests/flex_array_each_test.rb
@@ -160,7 +130,7 @@ files:
160
130
  - tests/range_test.rb
161
131
  - tests/spec_array_test.rb
162
132
  - tests/spec_component_test.rb
163
- homepage: http://teuthida-technologies.com/
133
+ homepage: https://github.com/PeterCamilleri/flex_array
164
134
  licenses:
165
135
  - MIT
166
136
  metadata: {}
@@ -180,9 +150,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
150
  version: '0'
181
151
  requirements: []
182
152
  rubyforge_project:
183
- rubygems_version: 2.2.2
153
+ rubygems_version: 2.5.2
184
154
  signing_key:
185
155
  specification_version: 4
186
156
  summary: A flexible array class.
187
157
  test_files: []
188
- has_rdoc: true
Binary file
@@ -1,109 +0,0 @@
1
- ---
2
- Attribute:
3
- enabled: false
4
- exclude: []
5
- BooleanParameter:
6
- enabled: true
7
- exclude: []
8
- ClassVariable:
9
- enabled: true
10
- exclude: []
11
- ControlParameter:
12
- enabled: true
13
- exclude: []
14
- DataClump:
15
- enabled: true
16
- exclude: []
17
- max_copies: 2
18
- min_clump_size: 2
19
- DuplicateMethodCall:
20
- enabled: true
21
- exclude: []
22
- max_calls: 1
23
- allow_calls: []
24
- FeatureEnvy:
25
- enabled: true
26
- exclude: []
27
- IrresponsibleModule:
28
- enabled: true
29
- exclude: []
30
- LongParameterList:
31
- enabled: true
32
- exclude: []
33
- max_params: 3
34
- overrides:
35
- initialize:
36
- max_params: 5
37
- LongYieldList:
38
- enabled: true
39
- exclude: []
40
- max_params: 3
41
- NestedIterators:
42
- enabled: true
43
- exclude: []
44
- max_allowed_nesting: 1
45
- ignore_iterators: []
46
- NilCheck:
47
- enabled: true
48
- exclude: []
49
- PrimaDonnaMethod:
50
- enabled: true
51
- exclude: []
52
- RepeatedConditional:
53
- enabled: true
54
- exclude: []
55
- max_ifs: 2
56
- TooManyInstanceVariables:
57
- enabled: true
58
- exclude: []
59
- max_instance_variables: 9
60
- TooManyMethods:
61
- enabled: true
62
- exclude: []
63
- max_methods: 25
64
- TooManyStatements:
65
- enabled: true
66
- exclude:
67
- - initialize
68
- max_statements: 7
69
- UncommunicativeMethodName:
70
- enabled: true
71
- exclude: []
72
- reject:
73
- - !ruby/regexp /^[a-z]$/
74
- - !ruby/regexp /[0-9]$/
75
- - !ruby/regexp /[A-Z]/
76
- accept: []
77
- UncommunicativeModuleName:
78
- enabled: true
79
- exclude: []
80
- reject:
81
- - !ruby/regexp /^.$/
82
- - !ruby/regexp /[0-9]$/
83
- accept:
84
- - Inline::C
85
- UncommunicativeParameterName:
86
- enabled: true
87
- exclude: []
88
- reject:
89
- - !ruby/regexp /^.$/
90
- - !ruby/regexp /[0-9]$/
91
- - !ruby/regexp /[A-Z]/
92
- - !ruby/regexp /^_/
93
- accept: []
94
- UncommunicativeVariableName:
95
- enabled: true
96
- exclude: []
97
- reject:
98
- - !ruby/regexp /^.$/
99
- - !ruby/regexp /[0-9]$/
100
- - !ruby/regexp /[A-Z]/
101
- accept:
102
- - _
103
- UnusedParameters:
104
- enabled: true
105
- exclude: []
106
- UtilityFunction:
107
- enabled: true
108
- exclude: []
109
- max_helper_calls: 1
data/sire.rb DELETED
@@ -1,82 +0,0 @@
1
- # coding: utf-8
2
- # Really simple program # 3
3
- # A Simple Interactive Ruby Environment
4
- # SIRE Version 0.2.6
5
-
6
- require 'readline'
7
- require 'pp'
8
- require_relative 'lib/flex_array'
9
- include Readline
10
-
11
- class Object
12
- def classes
13
- begin
14
- klass = self
15
-
16
- begin
17
- klass = klass.class unless klass.instance_of?(Class)
18
- print klass
19
- klass = klass.superclass
20
- print " < " if klass
21
- end while klass
22
-
23
- puts
24
- end
25
- end
26
- end
27
-
28
- def fp arr
29
- lim = arr.limits
30
- ec = lim[-1].max
31
- pp lim
32
- arr.each_with_index do |item, index|
33
- print " #{item} "
34
- puts if index[-1] == ec
35
- end
36
- puts
37
- nil
38
- end
39
-
40
- def q
41
- @done = true
42
- puts
43
- "Bye bye for now!"
44
- end
45
-
46
- def eval_puts(str)
47
- puts str
48
- eval str
49
- end
50
-
51
- puts "Welcome to SIRE for FlexArray"
52
- puts "Simple Interactive Ruby Environment"
53
- puts
54
- puts "Use command 'q' to quit."
55
- puts
56
- @done = false
57
-
58
- eval_puts "@a = FlexArray.new([2,3,4]) {|i| i.clone}"
59
- eval_puts "@b = FlexArray.new([2,3,4]) {|i| (i[0]+i[2])*(i[1] + i[2])}"
60
- eval_puts "@c = FlexArray.new([0,3])"
61
- eval_puts "@d = FlexArray.new([3,3]) {|i| i[0]*3 + i[1]}"
62
- puts
63
-
64
- until @done
65
- begin
66
- line = readline('SIRE>', true)
67
- result = eval line
68
- pp result unless result.nil?
69
- rescue Interrupt
70
- @done = true
71
- puts
72
- puts
73
- pp "I'm done here!"
74
- rescue Exception => e
75
- puts
76
- puts "#{e.class} detected: #{e}"
77
- puts e.backtrace
78
- puts
79
- end
80
- end
81
-
82
- puts