flex_array 0.3.2 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +0 -15
- data/.reek.yml +17 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/README.md +67 -0
- data/bench/benchmark.rb +243 -0
- data/bench/results.txt +97 -0
- data/flex_array.gemspec +6 -10
- data/irbt.rb +18 -0
- data/lib/flex_array.rb +13 -30
- data/lib/flex_array/array.rb +9 -24
- data/lib/flex_array/flex_array_append.rb +4 -23
- data/lib/flex_array/flex_array_each.rb +33 -208
- data/lib/flex_array/flex_array_forever.rb +6 -4
- data/lib/flex_array/flex_array_index.rb +4 -29
- data/lib/flex_array/flex_array_new.rb +9 -56
- data/lib/flex_array/flex_array_process.rb +23 -63
- data/lib/flex_array/flex_array_reshape.rb +13 -23
- data/lib/flex_array/flex_array_transpose.rb +7 -16
- data/lib/flex_array/flex_array_validate.rb +6 -15
- data/lib/flex_array/integer.rb +4 -13
- data/lib/flex_array/object.rb +4 -13
- data/lib/flex_array/range.rb +4 -13
- data/lib/flex_array/spec_array.rb +5 -9
- data/lib/flex_array/spec_component.rb +14 -22
- data/lib/flex_array/version.rb +1 -2
- data/rakefile.rb +1 -24
- data/reek.txt +9 -2
- data/tests/array_test.rb +0 -4
- data/tests/flex_array_append_test.rb +0 -23
- data/tests/flex_array_each_test.rb +483 -487
- data/tests/flex_array_index_test.rb +0 -4
- data/tests/flex_array_new_test.rb +0 -4
- data/tests/flex_array_reshape_test.rb +4 -4
- data/tests/flex_array_test.rb +0 -4
- data/tests/flex_array_transpose_test.rb +0 -4
- data/tests/flex_array_validate_test.rb +5 -4
- data/tests/integer_test.rb +0 -4
- data/tests/object_test.rb +0 -4
- data/tests/range_test.rb +0 -4
- data/tests/spec_array_test.rb +0 -4
- data/tests/spec_component_test.rb +0 -4
- metadata +19 -49
- data/docs/Flex_Array_UG.odt +0 -0
- data/docs/Flex_Array_UG_Version_0_3_0.pdf +0 -0
- data/flex_array.reek +0 -109
- data/readme.txt +0 -2
- data/sire.rb +0 -82
data/readme.txt
DELETED
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
|