Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Made frequency and next pull time work together

  • Loading branch information...
commit 6e8ed312e0102626aa3aa3ed0c7aeb15e1cfcb70 1 parent def947a
@brymck authored
View
7 lib/rupee/quote.rb
@@ -14,8 +14,10 @@ class Quote
# The cached HTML
attr :html
+ # The frequency in seconds that a quote's information should be updated
attr_accessor :frequency
+ # The time at which the next pull from the online quote source will occur
attr :next_pull
def initialize(ticker, opts = {})
@@ -63,6 +65,11 @@ def get(*params)
end
end
+ def frequency=(x)
+ @next_pull += (x - @frequency)
+ @frequency = x
+ end
+
private
# The URL for Bloomberg's quotes service
View
2  lib/rupee/version.rb
@@ -1,4 +1,4 @@
module Rupee
# The current version
- VERSION = "0.1.2"
+ VERSION = "0.1.3"
end
View
8 spec/import/quote_spec.rb
@@ -18,6 +18,14 @@
it "should return a price" do
@wfc.price.should be_a_kind_of Float
end
+
+ it "should reflect changes to frequency in next pull time" do
+ freq_change = 5
+ orig_freq = @wfc.frequency
+ orig_pull = @wfc.next_pull
+ @wfc.frequency -= freq_change
+ @wfc.next_pull.should == orig_pull - freq_change
+ end
end
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.