flex_array 0.3.3 → 0.3.4
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.
- checksums.yaml +4 -4
- data/README.md +48 -0
- data/irbt.rb +18 -0
- data/lib/flex_array/version.rb +1 -1
- data/rakefile.rb +1 -14
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6222b14c078c26591a64b3bb97c4a1fe2dfa1d48
|
4
|
+
data.tar.gz: 90006c528466e8c16420ad0e03b144f182e9309d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f86ba5b8086d23e8d323320ed3229161a6950afc5d8de0b4bd1129efb9aa202c14ade1e6d037157eaff5e8f0192c14a2ccdbd6620eb14b9d809636b1ee0d6ee1
|
7
|
+
data.tar.gz: ddf04804da0710b0a678d8769d1cd33a09d774aea30a333a4808f32eb963095575c17503a32b0f34048862890e6a596b1ae42d63d0adfc30de6264482225db56
|
data/README.md
CHANGED
@@ -3,6 +3,54 @@
|
|
3
3
|
This project contains the Ruby FlexArray gem. A gem used to facilitate the
|
4
4
|
creation and processing of multi-dimensional arrays in a flexible manner.
|
5
5
|
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'flex_array'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install flex_array
|
21
|
+
|
22
|
+
The flex_array gem itself is found at: ( https://rubygems.org/gems/flex_array )
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
Using flex_array in an application can be as simple as:
|
27
|
+
```ruby
|
28
|
+
require 'flex_array'
|
29
|
+
|
30
|
+
arr1 = FlexArray.new([10,10]) # 10 by 10 of nil
|
31
|
+
arr2 = FlexArray.new([10,10], 0) # 10 by 10 of zero
|
32
|
+
arr2 = FlexArray.new([1..12,1..12]) {|i| i[0]*i[1]} # Times table.
|
33
|
+
|
34
|
+
arr2[4..5,4..5] = 42 #Set the middle of the array.
|
35
|
+
|
36
|
+
```
|
37
|
+
|
6
38
|
A lot more information on the operation of this gem may be found in the docs
|
7
39
|
folder in the Flex_Array_UG, available in both open office (.odt) and portable
|
8
40
|
document (.pdf) formats.
|
41
|
+
|
42
|
+
## Contributing
|
43
|
+
|
44
|
+
#### Plan A
|
45
|
+
|
46
|
+
1. Fork it ( https://github.com/PeterCamilleri/flex_array/fork )
|
47
|
+
2. Switch to the development branch ('git branch development')
|
48
|
+
3. Create your feature branch ('git checkout -b my-new-feature')
|
49
|
+
4. Commit your changes ('git commit -am "Add some feature"')
|
50
|
+
5. Push to the branch ('git push origin my-new-feature')
|
51
|
+
6. Create new Pull Request
|
52
|
+
|
53
|
+
#### Plan B
|
54
|
+
|
55
|
+
Go to the GitHub repository and raise an issue calling attention to some
|
56
|
+
aspect that could use some TLC or a suggestion or an idea.
|
data/irbt.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
# An IRB + flex array Test bed
|
3
|
+
|
4
|
+
require 'irb'
|
5
|
+
|
6
|
+
puts "Starting an IRB console with flex array loaded."
|
7
|
+
|
8
|
+
if ARGV[0] == 'local'
|
9
|
+
require_relative 'lib/flex_array'
|
10
|
+
puts "flex_array loaded locally: #{FlexArray::VERSION}"
|
11
|
+
|
12
|
+
ARGV.shift
|
13
|
+
else
|
14
|
+
require 'flex_array'
|
15
|
+
puts "flex_array loaded from gem: #{FlexArray::VERSION}"
|
16
|
+
end
|
17
|
+
|
18
|
+
IRB.start
|
data/lib/flex_array/version.rb
CHANGED
data/rakefile.rb
CHANGED
@@ -25,22 +25,9 @@ task :reek do |t|
|
|
25
25
|
`reek --no-color lib > reek.txt`
|
26
26
|
end
|
27
27
|
|
28
|
-
def eval_puts(str)
|
29
|
-
puts str
|
30
|
-
eval str
|
31
|
-
end
|
32
|
-
|
33
28
|
desc "Run an interactive flex array session."
|
34
29
|
task :console do
|
35
|
-
|
36
|
-
require 'irb/completion'
|
37
|
-
require_relative 'lib/flex_array'
|
38
|
-
eval_puts "@a = FlexArray.new([2,3,4]) {|i| i.clone}"
|
39
|
-
eval_puts "@b = FlexArray.new([2,3,4]) {|i| (i[0]+i[2])*(i[1] + i[2])}"
|
40
|
-
eval_puts "@c = FlexArray.new([0,3])"
|
41
|
-
eval_puts "@d = FlexArray.new([3,3]) {|i| i[0]*3 + i[1]}"
|
42
|
-
ARGV.clear
|
43
|
-
IRB.start
|
30
|
+
system "ruby irbt.rb local"
|
44
31
|
end
|
45
32
|
|
46
33
|
desc "What version of flex_array is this?"
|
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.
|
4
|
+
version: 0.3.4
|
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-
|
11
|
+
date: 2016-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -123,6 +123,7 @@ files:
|
|
123
123
|
- flex_array
|
124
124
|
- flex_array.gemspec
|
125
125
|
- flex_array.reek
|
126
|
+
- irbt.rb
|
126
127
|
- lib/flex_array.rb
|
127
128
|
- lib/flex_array/array.rb
|
128
129
|
- lib/flex_array/flex_array_append.rb
|