podcsv 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2063aefdf28a7cc548de6b13a26c4aac2c1383e
4
- data.tar.gz: ce128de96cd979ade07e762f509b486fcda30948
3
+ metadata.gz: 5384b630209665f2a102fed2bf303483371e10a0
4
+ data.tar.gz: 825be9602722f5c8d569b5a5e73de835e2707840
5
5
  SHA512:
6
- metadata.gz: e86f4aa504004fe9dac8d9874264cb351c3c8ed30d1416fa75116ff55a858a13c077687eb14d99e0f1d8ee03517d79b5fb1948f10b16fd09e979ddb38b22b87b
7
- data.tar.gz: 3684b1c99503f9a5c32bb6730dd68c07256c94d62b99dbc399beb875013a1853ba835358a27a19a4357f241b5c1cba17b1c300765c1943a0dbceba2bea71c2e0
6
+ metadata.gz: 5d34b796ec656ff09fc5e37587dd4cf93087e87b3d36a8c444f4ef58b1fe3a9929dfe39f6656929f26741fcd4b54c1fd0a1d88f16ffc0db5b08e68b15d056265
7
+ data.tar.gz: 886112480de251a7ef9c5dfbb66f01348cf9275bb4399cfb82f8a82f50303c917fedc3b59c8771d401de7bef93aeb9e1d10f5e83d371f4dd8f42acf5603629ca
data/README.md CHANGED
@@ -97,7 +97,7 @@ ary = PodCSV.read( file, {},
97
97
 
98
98
  ## 4. Development
99
99
 
100
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake rspec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
100
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
101
101
 
102
102
 
103
103
  ## 5. Contributing
@@ -1,3 +1,3 @@
1
1
  class PodCSV
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/podcsv.rb CHANGED
@@ -77,25 +77,50 @@ class PodArray < Array
77
77
  @_cache[args] # return the value of self[args].
78
78
  #self[args]
79
79
  #self[args] = @_cache[args]
80
- else
80
+
81
+ elsif args.is_a?(Range)
81
82
  # Range, etc.
82
83
  # $stderr.puts "[INFO] access for #{args} (#{args.class})."
83
84
 
84
85
  # copy partial array.
85
- idxs = Array(args)
86
- pary = idxs.map{|ii| self[ii]}
86
+ #idxs = Array(args)
87
+ #pary = idxs.map{|ii| self[ii]}
88
+ b = args.begin
89
+ e = args.end
90
+ e += self.size if args.max.nil?
91
+ rr = unless args.exclude_end?
92
+ b..e
93
+ else
94
+ b...e
95
+ end
96
+ #$stderr.puts "{#{self.class}##{__method__}} args: #{args} / rr: #{rr}"
97
+
98
+ pary = super(args)
87
99
  ret = PodArray.new(
88
100
  # Integer
89
101
  pary
90
102
  )
103
+ # $stderr.puts "{#{self.class}##{__method__}}"+
104
+ # " @_cache in ret: #{ret.instance_eval{@_cache}}"+
105
+ # " (#{ret.instance_eval{@_cache}.class})}"
91
106
 
92
107
  # copy partial cache.
93
- ini_cache = self._cache
94
- idxs.each {|ii|
95
- ret.instance_eval{ @_cache[ii] = ini_cache[ii] }
96
- }
108
+ ret.instance_eval{ @_cache = {} }
109
+ _cache.keys.each do |k|
110
+ tmp_k = (k>=0)? k : self.size+k
111
+ val = _cache[k]
112
+ # $stderr.puts "{#{self.class}##{__method__}}"+
113
+ # " k: #{k}, tmp_k: #{tmp_k} val: #{val} (#{_cache[k]})"
114
+
115
+ if rr.include? tmp_k
116
+ new_k = k - b
117
+ ret.instance_eval{ @_cache[new_k] = val }
118
+ end
119
+ end
97
120
 
98
121
  ret
122
+ else
123
+ raise "Not yet implemented for #{args.class}"
99
124
  end
100
125
  end
101
126
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podcsv
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - YAMAMOTO, Masayuki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-06-10 00:00:00.000000000 Z
11
+ date: 2018-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -94,7 +94,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
94
94
  version: '0'
95
95
  requirements: []
96
96
  rubyforge_project:
97
- rubygems_version: 2.4.6
97
+ rubygems_version: 2.5.2
98
98
  signing_key:
99
99
  specification_version: 4
100
100
  summary: Parse-on-demand CSV.