cstock 0.4.1 → 0.4.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: c54a8315a819fcdfe54cb6205b854d9a8b32fae6
4
- data.tar.gz: 67a8dd677577ee9fed09f88437622361bb5b36f7
3
+ metadata.gz: 0e0315ba814b65cfc27b1d1fabe2be64eba8c66c
4
+ data.tar.gz: b94b807edac4e43126ad4db54443fd56ae5ab583
5
5
  SHA512:
6
- metadata.gz: 400344ed7670eb06ecfa69c0106a7f186e63e4c9d31f5734c6eea3c795e19684e1625a9310fbe12958a90dea3a10d1fbc2a67f3f0e4595828c91e5c303deccd3
7
- data.tar.gz: 0e5529cf4236e2fb598408ccececa86e03163117d859fe1cd374acfa22f2b8320d5e659438a9f057973a5bc327021a6647d09fd57adc0ca2d607fd6c35a5e9f3
6
+ metadata.gz: 492074f1e2d41e73c6b0b0fb7c10c5cef7dad73c0c6e0b05cfd3ac5e64d4e284ea18e4030c87ab6d7aaebb65bfc0d59c2ac520ffd5d0a5c914d6b5e8f752d04a
7
+ data.tar.gz: da89bb54b5b05c6fd7990cb7e310c31a53b83eb6032a4775fb94932cc8a6fe4c641a1021c9adfb3f2ccaf640e8f82205d84ddcba742d70870adeb9707de7a8b9
data/.gitignore CHANGED
@@ -1,2 +1,4 @@
1
1
  *.gem
2
+ Gemfile.lock
3
+ pkg/*
2
4
 
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source "http://rubygems.org"
2
+
3
+ # Specify your gem's dependencies in stock_check.gemspec
4
+ gemspec
data/Rakefile ADDED
@@ -0,0 +1 @@
1
+ require 'bundler/gem_tasks'
data/lib/cstock/stock.rb CHANGED
@@ -46,6 +46,8 @@ module CStock
46
46
  end
47
47
  end
48
48
 
49
+ ##
50
+ # block can yield after each stock refresh
49
51
  def self.refresh(stocks)
50
52
  stocks = [stocks] if not stocks.respond_to?(:each)
51
53
  stock_codes = stocks.map(&:code)
@@ -53,6 +55,7 @@ module CStock
53
55
  quote(stock_codes) do |datas|
54
56
  datas.each_with_index do |data, index|
55
57
  stocks[index].set_fields data
58
+ yield stocks[index] if block_given?
56
59
  end
57
60
  end
58
61
  stocks
@@ -1,4 +1,4 @@
1
1
  # =>CStock::VERSION
2
2
  module CStock
3
- VERSION = '0.4.1'
3
+ VERSION = '0.4.2'
4
4
  end
data/spec/cstock_spec.rb CHANGED
@@ -47,7 +47,9 @@ describe CStock::Stock do
47
47
  it "refresh muti stocks at one quote" do
48
48
  expect(@s.name).to eq("name")
49
49
  expect(@s2.name).to eq("name")
50
- CStock::Stock.refresh(@stocks).each do |stock|
50
+ CStock::Stock.refresh(@stocks) do |s|
51
+ expect(s.name).not_to eq("name")
52
+ end.each do |stock|
51
53
  expect(@s.name).to eq("浦发银行")
52
54
  expect(@s2.name).to eq("大北农")
53
55
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cstock
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aston Fu
@@ -61,8 +61,10 @@ extra_rdoc_files: []
61
61
  files:
62
62
  - .gitignore
63
63
  - .rspec
64
+ - Gemfile
64
65
  - LICENSE
65
66
  - README.md
67
+ - Rakefile
66
68
  - bin/cstock
67
69
  - cstock.gemspec
68
70
  - lib/cstock.rb