tatara 0.2.0 → 0.3.0

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.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +17 -1
  3. data/.gitignore +1 -0
  4. data/Gemfile +0 -1
  5. data/Gemfile.lock +0 -2
  6. data/Makefile +11 -73
  7. data/README.md +2 -1
  8. data/docs/tatara/float_array.md +65 -0
  9. data/docs/tatara/float_vector.md +64 -0
  10. data/docs/tatara/integer_array.md +64 -0
  11. data/docs/tatara/integer_vector.md +64 -0
  12. data/docs/tatara/string_array.md +64 -0
  13. data/docs/tatara/string_vector.md +64 -0
  14. data/ext/tatara/array/array.hpp +5 -119
  15. data/ext/tatara/array/float/float_array.hpp +132 -0
  16. data/ext/tatara/array/integer/int_array.hpp +132 -0
  17. data/ext/tatara/array/string/string_array.hpp +133 -0
  18. data/ext/tatara/extconf.rb +1 -1
  19. data/ext/tatara/float/float.hpp +148 -0
  20. data/ext/tatara/integer/integer.hpp +164 -0
  21. data/ext/tatara/map/float/float_float_map.hpp +66 -0
  22. data/ext/tatara/map/float/float_int_map.hpp +66 -0
  23. data/ext/tatara/map/float/float_string_map.hpp +67 -0
  24. data/ext/tatara/map/integer/int_float_map.hpp +66 -0
  25. data/ext/tatara/map/integer/int_int_map.hpp +66 -0
  26. data/ext/tatara/map/integer/int_string_map.hpp +67 -0
  27. data/ext/tatara/map/map.hpp +14 -27
  28. data/ext/tatara/map/string/string_float_map.hpp +67 -0
  29. data/ext/tatara/map/string/string_int_map.hpp +67 -0
  30. data/ext/tatara/map/string/string_string_map.hpp +67 -0
  31. data/ext/tatara/string/string.hpp +105 -0
  32. data/ext/tatara/tatara.cpp +245 -244
  33. data/ext/tatara/vector/float/float_vector.hpp +132 -0
  34. data/ext/tatara/vector/integer/int_vector.hpp +132 -0
  35. data/ext/tatara/vector/string/string_vector.hpp +133 -0
  36. data/ext/tatara/vector/vector.hpp +4 -0
  37. data/lib/tatara/array/array.rb +73 -0
  38. data/lib/tatara/vector/vector.rb +77 -0
  39. data/lib/tatara/version.rb +1 -1
  40. data/tatara.gemspec +1 -0
  41. metadata +31 -2
@@ -18,9 +18,86 @@ module Tatara
18
18
  (0...(self.size)).each{|i| block.call(self[i], i)}
19
19
  end
20
20
 
21
+ def intersection(other)
22
+ copy = self.dup
23
+ result = self.to_array & other.to_array
24
+ copy.clear
25
+ result.map(&copy.method(:<<))
26
+ return copy
27
+ end
28
+
21
29
  def &(other)
22
30
  self.intersection other
23
31
  end
32
+
33
+ def sort
34
+ copy = self.dup
35
+ result = self.to_array.sort
36
+ copy.clear
37
+ result.each{|v| copy << v}
38
+ return copy
39
+ end
40
+
41
+ def sort!
42
+ result = self.to_array.sort
43
+ self.clear
44
+ result.each{|v| self << v}
45
+ return self
46
+ end
47
+
48
+ def sum
49
+ self.to_array.inject(:+)
50
+ end
51
+
52
+ def uniq
53
+ copy = self.dup
54
+ result = self.to_array.uniq
55
+ copy.clear
56
+ result.map(&copy.method(:<<))
57
+ return copy
58
+ end
59
+
60
+ def uniq!
61
+ result = self.to_array.uniq
62
+ self.clear
63
+ result.each{|v| self << v}
64
+ return self
65
+ end
66
+
67
+ def reverse
68
+ copy = self.dup
69
+ result = self.to_array.reverse
70
+ result.each{|v| copy << v }
71
+ return copy
72
+ end
73
+
74
+ def reverse!
75
+ result = self.to_array.reverse
76
+ self.clear
77
+ result.each{|v| self << v }
78
+ return self
79
+ end
80
+
81
+ def slice(start, length)
82
+ copy = self.dup
83
+ result = self.to_array.slice(start, length)
84
+ copy.clear
85
+ result.each{|v| copy << v }
86
+ return copy
87
+ end
88
+
89
+ def slice!(start, length)
90
+ result = self.to_array.slice(start, length)
91
+ self.clear
92
+ result.each{|v| self << v }
93
+ return self
94
+ end
95
+
96
+ def to_array
97
+ result = []
98
+ self.map{|v| result << v}
99
+ result
100
+ end
24
101
  end
25
102
 
26
103
  class IntVector
@@ -1,3 +1,3 @@
1
1
  module Tatara
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
@@ -39,4 +39,5 @@ Gem::Specification.new do |spec|
39
39
  spec.add_development_dependency "bundler", "~> 2.0"
40
40
  spec.add_development_dependency "rake", "~> 10.0"
41
41
  spec.add_development_dependency "minitest", "~> 5.0"
42
+ spec.add_development_dependency "simplecov"
42
43
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tatara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - S-H-GAMELINKS
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-11-18 00:00:00.000000000 Z
11
+ date: 2019-11-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: simplecov
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ">="
67
+ - !ruby/object:Gem::Version
68
+ version: '0'
55
69
  description: Simple type declaration lib
56
70
  email:
57
71
  - gamelinks007@gmail.com
@@ -93,12 +107,27 @@ files:
93
107
  - docs/tatara/string_string_map.md
94
108
  - docs/tatara/string_vector.md
95
109
  - ext/tatara/array/array.hpp
110
+ - ext/tatara/array/float/float_array.hpp
111
+ - ext/tatara/array/integer/int_array.hpp
112
+ - ext/tatara/array/string/string_array.hpp
96
113
  - ext/tatara/extconf.rb
97
114
  - ext/tatara/float/float.hpp
98
115
  - ext/tatara/integer/integer.hpp
116
+ - ext/tatara/map/float/float_float_map.hpp
117
+ - ext/tatara/map/float/float_int_map.hpp
118
+ - ext/tatara/map/float/float_string_map.hpp
119
+ - ext/tatara/map/integer/int_float_map.hpp
120
+ - ext/tatara/map/integer/int_int_map.hpp
121
+ - ext/tatara/map/integer/int_string_map.hpp
99
122
  - ext/tatara/map/map.hpp
123
+ - ext/tatara/map/string/string_float_map.hpp
124
+ - ext/tatara/map/string/string_int_map.hpp
125
+ - ext/tatara/map/string/string_string_map.hpp
100
126
  - ext/tatara/string/string.hpp
101
127
  - ext/tatara/tatara.cpp
128
+ - ext/tatara/vector/float/float_vector.hpp
129
+ - ext/tatara/vector/integer/int_vector.hpp
130
+ - ext/tatara/vector/string/string_vector.hpp
102
131
  - ext/tatara/vector/vector.hpp
103
132
  - lib/tatara.rb
104
133
  - lib/tatara/array/array.rb